[ create a new paste ] login | about

Link: http://codepad.org/LZx8iIkl    [ raw code | output | fork ]

C, pasted on Jul 18:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<stdio.h>
int main(){
 char a1[6],       // one dimensional
     a2[7][6],    // two dimensional 
     a3[5][7][6]; // // Three dimensional

 printf("sizeof(a1)    : %lu \n", sizeof(a1));
 printf("sizeof(a2)    : %lu \n", sizeof(a2));
 printf("sizeof(a3)    : %lu \n", sizeof(a3));
 printf(" Char         : %lu \n", sizeof(char));
 printf(" Char[5]      : %lu \n", sizeof(char[6]));
 printf(" Char[5][7]   : %lu \n", sizeof(char[7][6]));
 printf(" Char[5][7][6]: %lu \n", sizeof(char[5][7][6]));
 
 return 1;
}


Output:
1
2
3
4
5
6
7
sizeof(a1)    : 6 
sizeof(a2)    : 42 
sizeof(a3)    : 210 
 Char         : 1 
 Char[5]      : 6 
 Char[5][7]   : 42 
 Char[5][7][6]: 210 


Create a new paste based on this one


Comments: