#include<stdio.h>
#define TOTAL_ELEMENTS (sizeof(array)/sizeof(array[0]))
int array[] = {23,34,12,17,204,99,16};
int main()
{
int d = -1;
if (d < TOTAL_ELEMENTS)
printf("of course -1 is less than %d",TOTAL_ELEMENTS);
else
printf("how on earth");
return 0;
}
答案是:::上述程序的輸出是:如何在地球上
你的問題是什麼? – 2012-03-01 15:56:19
另請參閱:http://stackoverflow.com/questions/950051/confused-about-c-macro-expansion-and-integer-arithmetic – Mat 2012-07-01 17:16:40