What’s the difference between long long and long? And they both don’t work with 12 digit numbers (600851475143), am I forgetting something?
#include <iostream>
using namespace std;
int main(){
long long a = 600851475143;
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Going by the standard, all that’s guaranteed is:
intmust be at least 16 bitslongmust be at least 32 bitslong longmust be at least 64 bitsOn major 32-bit platforms:
intis 32 bitslongis 32 bits as welllong longis 64 bitsOn major 64-bit platforms:
intis 32 bitslongis either 32 or 64 bitslong longis 64 bits as wellIf you need a specific integer size for a particular application, rather than trusting the compiler to pick the size you want,
#include <stdint.h>(or<cstdint>) so you can use these types:int8_tanduint8_tint16_tanduint16_tint32_tanduint32_tint64_tanduint64_tYou may also be interested in
#include <stddef.h>(or<cstddef>):size_tptrdiff_t