注意点

#include <stdio.h>
void generate(char *str)
{
    static char separator = ' ';
    printf("%c %s",separator,str);
    separator = ',';
}

int main()
{
    char *strs[] = {"china","japan","usa"};
    int i = 0;
    for(;i<sizeof(strs)/sizeof(strs[0]);i++)
    {
     generate(strs[i]);
    }
    printf("\r\n");
}

 

运算符

int main()
{
    int a = 3;
    int *p = &a;
    int apple = sizeof(int)*p;//猜猜看,*会理解成乘号还是解引用操作。
    printf("sizeof:%d",apple);
    printf("\r\n");
}
//答案是,会被当作解引用操作,所以这段代码没办法编译通过

 

 

 

posted @ 2013-01-06 14:37  周尚武  阅读(165)  评论(0编辑  收藏  举报