[ create a new paste ] login | about

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

C, pasted on Mar 1:
1
2
3
4
5
6
7
8
9
10
11
#include <stdio.h>
int fun(char arr[][2]){
  printf("sizeof arr is %d bytes\n", (int)sizeof arr);
}
int main(void) {
  char arr[][2] = {{'a','b'}, {'c','d'}, {'d','e'}};
  printf("sizeof arr is %d bytes\n", (int)sizeof arr);
  printf("number of elements: %d\n", (int)(sizeof arr/sizeof arr[0]));
  fun(arr);
  return 0;
}


Output:
1
2
3
sizeof arr is 6 bytes
number of elements: 3
sizeof arr is 4 bytes


Create a new paste based on this one


Comments: