#include <stdio.h>
#include <stdlib.h>
int main()
{
const char *testArr1[] = {"one","two"};
const char *testArr2[] = {"one"};
const char *testArr3[] = {0};
unsigned int num;
num = sizeof testArr1 / sizeof *testArr1;
printf("testArr1: %d\n", num);
num = sizeof testArr2 / sizeof *testArr2;
printf("testArr2: %d\n", num);
num = sizeof testArr3 / sizeof *testArr3;
printf("testArr3: %d\n", num);
if( num==1 && testArr3[0] == NULL) printf("null\n");
return 0;
}
/*
output:
testArr1: 2
testArr2: 1
testArr3: 1
null
*/
Comments