how do I find the length of and array using sizeof()
Damm I forgot this I knew this a week ago but it slipped out.
Code:
#include<stdio.h>
main()
{
int x;
char array[100][50] =
{
{"element 1"},
{"element 2"},
{"element 3"},
{"element 4"}
};
x = sizeof(array)/sizeof(array[0]);
printf("the size of the array is %d",x);
getchar();
}
I am not getting the right results it should be 4 not 100 I forgot this I knew this a week ago. I guess the old saying is true in programming if you don't use it you lose it