![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| to get the correct value with unsigned int | naan | High Level Programming | 2 | 04-11-2007 03:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
How can I store and/or print() a number that is larger than 4 294 967 295 in C? is int64_t or u_int64_t what I need ? if, so how can I printf it to stdout?
|
| Forum Sponsor | ||
|
|
|
||||
|
On HP-UX, this program works:
Code:
#include<stdlib.h>
#include<stdio.h>
main()
{
long i;
i=5000000000;
printf("i = %ld \n", i);
exit (0);
}
This page says: Quote:
|
|
|||
|
I wasn't sure is this was HP-UX specific, there is a weirdicious feature in GCC that will make the aforementioned program work with two changes (at least under Linux)
Use data type long long l; /* Not typo! will compile */ and printf("%Ld", l); /* Notice capital L */ If GCC is used on various Os'es, it should work. (I just checked on Solaris, it prints 1 :-( Atle
__________________
PS All of the above is to be read as '... unless I am wrong' ENDPS |
|||
| Google The UNIX and Linux Forums |