C语言第2天

注释:

// 单行注释,换行结束

/* */  以 /* 开始,*/ 结束,可以包含多行

注意:在字符串中,上述注释无效,如:

1 printf("//test 
");
1 printf("/* test */ 
");

输出分别是:

//test

/* test */

-------------------------------------------------------------------

占位符:

代码:

 1 #include<stdio.h>
 2 int main()
 3 {
 4     int a,b,sum;
 5     a=123;
 6     b=456;
 7     sum = a + b;
 8     printf("sum is %d
",sum);
 9     return 0;
10 }

运行结果:

sum is 579

第8行“%d”是占位符,d表示数据类型(这里指十进制整数类型),%d输出sum的值

 -------------------------------------------------------------------

书签:《c程序设计》第四版,谭浩强,P8

原文地址:https://www.cnblogs.com/start-from-scratch/p/11839933.html