REVIEW
ans
它们被称为函数
2.什么是语法错误?给出一个英语例子和一个C语言例子
me
C的语法错误是指把正确的C符号放在了错误的位置
likes coding He.
int main(void)
()
ans
语法错误就是指违背了如何把语句或程序放置在一起的规则。
Me speaks English good.
printf "where are the parentheses?";
3.什么是语义错误?给出一个英语例子和一个C语言例子
ans
语义错误就是指含义上的错误(编译不出语法错误)。
My favorite singer is GuoDegang.
thrice_n = 3 + n;
4.评定下面的程序
#include <</font>studio.h>
int main(void)
({
int s;
s: = 56;s=
56;
printf ("There are
s%d
weeks in a year.",s);
return 0;
)}
PRACTICE
1.利用printf函数输出姓名
#include
int main(void)
{
printf("Tom Smith
");
printf("Tom
Smith
");
printf("Tom ");
printf("Smith
");
return 0;
}
2.输出您的姓名和地址
#include
int main(void)
{
}
3.把年龄转换成天数并显示二者的值
#include
int main(void)
{
}
4.
#include
void prnt1(void);
void prnt2(void);
int
main(void) //主函数定义用
int main(void)
{
prnt1();
prnt1();
prnt1();
prnt2();
return 0;
}
{
}
void prnt1(void) //子函数定义用 void
func(void)
{
printf("For Tom is a jolly good
fellow!
");
}
void prnt2(void)
{
printf("Which nobody can deny!!!
");
}
{
}
void prnt2(void)
{
}
5.
#include
int main(void)
{
}
6.
#include
void prt_s(void);
void prt_n(void);
int main(void)
{
prt_s();
prt_s();
prt_s();
prt_n();
prt_s();
prt_s();
prt_n();
prt_s();
prt_n();
{
}
void prt_s(void)
{
printf("Smile!");
}
{
}
void prt_n(void)
{
printf("
");
}
{
}
7.
#include
void one_three(void);
void two(void);
int main(void)
{
printf("starting now:
");
one_three();
printf("done!
");
{
}
void one_three()
{
printf("one
");
two();
printf("three
");
}
{
}
void two()
{
printf("two
");
}
{
}