Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

40,039 questions

52,004 answers

573 users

How to guarantee a 64‑bit integer across platforms in C++

1 Answer

0 votes
#include <iostream>
#include <cstdint>

int main() {
    // int64_t x;      // exactly 64 bits
    // uint64_t y;     // unsigned 64 bits

    int64_t x = -123456789012345;
    uint64_t y = 123456789012345ULL;

    std::cout << "x = " << x << "\n";
    std::cout << "y = " << y << "\n";
}


/*
run:

x = -123456789012345
y = 123456789012345

*/

 



answered 1 hour ago by avibootz
...