数组问题
#include <stdio.h>#define NUM 5
int main()
{
char slogans = {
"I love FishC.com!",
"Keep moving!",
"Impossible is nothing!",
"Just do it!",
"I am what I am!"};
int i;
for (i = 0; i < NUM; i++)
{
printf("%s\n", slogans);
}
return 0;
}
有无朋友帮我解释一下里面的for循环 这怎么解释。。就是i的值从0加到4然后for循环执行5次然后分别打印出slogans这个数组里的5个字符串 slogans 0123456789..............100
0 "I love FishC.com!", slogans
1 "Keep moving!", slogans
2 "Impossible is nothing!", slogans
3 "Just do it!", slogans
4 "I am what I am!" slogans
slogans是这样存储滴
这样在for循环打印slogans,就是对应的字符串
页:
[1]