Why does the following code generate a compile error? Edit: My original code wasn\'t clear - I\'ve split the code up i开发者_JAVA百科nto separate files...
I\'m sure there are sometimes good reasons for taking the sizeof() a #define in C, but I occasionally come across bugs where someone has taken the sizeof() a #define instead of the sizeof() a structur
#include<stdio.h> 开发者_Go百科 #define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0])) int array[] = {23, 34, 12, 17, 204, 99, 16};
Sorry scratch my last post, it\'s way to late =S But basically I\'m having problems sending out the buffer I created. Just need to know where I\'m going wrong =( or if theres a better way.
I understand that sizeof is an oper开发者_如何学运维ator, which is evaluated at compile time to an integer constant.
It seems sizeof is not a real function? for example, if you write like this: int i=0; printf(\"%d\\n\", sizeof(++i));
When answering a comment to another answer of mine here, I found what I think may be a hole in the C standard (c1x, I haven\'t checked the earlier ones and yes, I know it\'s incredibly 开发者_开发知识