problem in type 64 bit (long long and __int64)

Status
Not open for further replies.

syedshan

Advanced Member level 1
Joined
Feb 27, 2012
Messages
463
Helped
27
Reputation
54
Reaction score
26
Trophy points
1,308
Location
Jeonju, South Korea
Activity points
5,134
hello all


I have a problem while dealing with 64-bit variable...The code shows it as 32 bit instead...What is wrong with it...

Note that I have tried long long as well as __int64

please see the code snippet[
Code:
#include<iostream>
#include<fstream>
#include <stdio.h>
#include <Windows.h>
#include <string.h>

using namespace std;

int main (void){
signed short int *sh_pbuff;
signed long long *ln_pbuff;
__int64 long_temp = 0xfffffffffffffff; //previously used [I]long long[/I] but got the same result as now

printf("size of long is %I64d\n\n", sizeof(long_temp));
printf("value of initialzition for long_temp is %x\n\n", long_temp);
..
..

 

Wrong print format specifier? It's an implementation dependent thing, did you review the compiler manual?

With gcc, %llx would be right for long long.
 

You can use a header file
#include<stdint.h>

typedef uint64_t Variable NAME

OR Simply INCLUDE a 'L' after the variable value name it itself indicates that it's 64 bit VBariable

For example - unsigned long long rts = 50L;

Here rts is a variable for 64 bit
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…