
C语言编程菜鸟问题:关于编译出错
本人刚学C语言,在编译时候出错不知道如何解决,求大家帮忙,以下为源代码:/*Demonstraesunaryopertorprefixandpostfixmodes*/#...
本人刚学C语言,在编译时候出错不知道如何解决,求大家帮忙,以下为源代码:
/* Demonstraes unary opertor prefix and postfix modes */
#include <stdio.h>
int a, b;
int main(void)
{
/*Set a and b both equal to 5*/
a = b = 5
/* Print them, decrementing each time. */
/* Use prefix mode for b,postfix mode for a */
printf("\nPost Pre");
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d\n",a--,--b);
return 0;
}
我的编译器是DEV C++4,编译时提示第15行出错:parse error before printf,应该如何解决? 展开
/* Demonstraes unary opertor prefix and postfix modes */
#include <stdio.h>
int a, b;
int main(void)
{
/*Set a and b both equal to 5*/
a = b = 5
/* Print them, decrementing each time. */
/* Use prefix mode for b,postfix mode for a */
printf("\nPost Pre");
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d\n",a--,--b);
return 0;
}
我的编译器是DEV C++4,编译时提示第15行出错:parse error before printf,应该如何解决? 展开
展开全部
你一定是刚学,这个时候你最好能细点心.
a = b = 5;你就是少加个分号.
这个东西你学一段时间就发现了,其实语法很简单的
a = b = 5;你就是少加个分号.
这个东西你学一段时间就发现了,其实语法很简单的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include <stdio.h>
int a, b;
int main(void)
{
/*Set a and b both equal to 5*/
a = b = 5;
/* Print them, decrementing each time. */
/* Use prefix mode for b,postfix mode for a */
printf("\nPost Pre");
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d\n",a--,--b);
return 0;
}
如此即可。
int a, b;
int main(void)
{
/*Set a and b both equal to 5*/
a = b = 5;
/* Print them, decrementing each time. */
/* Use prefix mode for b,postfix mode for a */
printf("\nPost Pre");
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d",a--,--b);
printf("\n %d\n",a--,--b);
return 0;
}
如此即可。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
a = b = 5 ;
是不是没 加;号
是不是没 加;号
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不够细心
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
少了个;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询