C Tutorial/Data Type/Long

Материал из C\C++ эксперт
Перейти к: навигация, поиск

Get size and address for long integer

<source lang="cpp">#include<stdio.h> int main(void) {

 long a = 1L;
 long b = 2L;
 long c = 3L;
 printf("A variable of type long occupies %d bytes.", sizeof(long));
 printf("\nHere are the addresses of some variables of type long:");
 printf("\nThe address of a is: %p  The address of b is: %p", &a, &b);
 printf("\nThe address of c is: %p", &c);
 return 0;

}</source>

A variable of type long occupies 4 bytes.
     Here are the addresses of some variables of type long:
     The address of a is: 9a37c  The address of b is: 9a378
     The address of c is: 9a374