Mega Code Archive

 
Categories / C Tutorial / Data Type
 

Get size and address for long integer

#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; } 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