sizeof
-
How to know the size of array [] in CComputer/linux 2008. 4. 23. 21:42
int sz, array[] = {1,2,3,4,5}; sz = sizeof(array)/sizeof(int); for(i = 0;i < sz; i++ ) {..................} const char *const canvas_type[6] = { "A", "B", "C", "D", "E", "F" }; int sz = sizeof(canvas_type)/sizeof(char*); With 64 bit AMD machine, the above mathod has a compiled problem.