C语言期末考试复习资料.pptVIP

  • 11
  • 0
  • 约1.34万字
  • 约 100页
  • 2019-01-31 发布于浙江
  • 举报
void swap(int *p1,int *p2) { int temp; temp=*p1; *p1=*p2; *p2=temp; } 下面的函数: void swap(int a,int b) { int temp; temp=a; a=b; b=temp; /* 只在函数中交换了局部变量 */ } 同样不可用函数: void swap(int *p,int b) 或 void swap(int a,int *p) 只能用函数 void swap(int *p1,int *p2) 处理主调用函数中的变量 1 多写了分号 void main( ); for(i=0;i10;i++); while(m!=0); 2 把分号写成了逗号 for(i=0,i10,i++); 3 写错了 scanf(“%d”,a); //应该是a,少了 gets(str); // 应该是str,多了 4 缺少函数体前后的花括号 { } 5 printf,scanf 中把双引号 ”写成 单引号 ’ 6 语句后缺少分号 c=a+b 7 数据声明中把逗号写成分号: 把 int a,b,c; 写成: int a;b;c; 4. st

文档评论(0)

1亿VIP精品文档

相关文档