C examples for Data Type:int
To declare and initialize the long type variable Big_Number, you could write this:
#include <stdio.h> int main(void) { long Big_Number = 1287600L; printf("%d",Big_Number); return 0;/*from w w w .j ava 2s. co m*/ }
You write negative integer constants with a minus sign, for example:
#include <stdio.h> int main(void) { int decrease = -4; long level = -100000L; printf("%d",decrease); return 0; //w w w . j ava 2s . co m }
You specify integer constants to be of type long long by appending two Ls:
#include <stdio.h> int main(void) { long long big_number = 123456789LL; printf("%d",big_number); /*w w w .ja v a2 s .co m*/ return 0; }
To specify a constant to be of an unsigned type, you append a U, as in these examples:
#include <stdio.h> int main(void) { unsigned int count = 100U; unsigned long value = 999999999UL; printf("%d",value); //from www . j a va2s. c om return 0; }
To store integers with the largest magnitude, you could define a variable as the following example.
The ULL specifies that the initial value is type unsigned long long.
#include <stdio.h> int main(void) { unsigned long long metersPerLightYear = 9460730472580800ULL; printf("%d",metersPerLightYear); /*w w w.j av a2s. c o m*/ return 0; }