回 帖 发 新 帖 刷新版面

主题:字符串数组的一个小程序问题

请各位帮帮我看看这个程序的错误

#include <stdio.h>
#include<stdlib.h>
int main (void)
[
char* pday[7];
pday[0]="sunday";
pday[1]="monday";
pday[2]="tuesday";
pday[3]="wednesday";
pday[4]="thursday";
pday[5]="friday";
pday="saturday";
char** plast;
char** pwalker;
//statements



printf("the day of the week:");
plast=pday+6;
for(pwalker=pday;pwalker<=plast;pwalker++)
printf("%s\n",*pwalker);
return(0);
}

回复列表 (共1个回复)

沙发

#include <stdio.h>
#include <stdlib.h>
int main()
{
    char *pday[7];
    pday[0]="sunday";
    pday[1]="monday";
    pday[2]="tuesday";
    pday[3]="wednesday";
    pday[4]="thursday";
    pday[5]="friday";
    pday[6]="saturday";
    char** plast;
    char** pwalker;
    //statements
    
    printf("the day of the week:");
    printf("\n");
    plast=pday+6;
    for(pwalker=pday;pwalker<=plast;pwalker++)
        printf("%s\n",*pwalker);
    return 0;
}

//pday[6]="saturday";楼主太粗心了吧,应该不用我解释了吧。

我来回复

您尚未登录,请登录后再回复。点此登录或注册