#define M 10 main() {
float a[M]; ...... }
该程序正确。
E、#include
float a[M+N]; }
该程序正确。
(2) 运行下面的C语言程序。运行结果可以说明什么问题? #include
main() { int num[5]={1,2,3,4,5,}; int i; for(i=0;i<5;i++) printf(\}
运行结果:
(3) 请上机运行这个程序,指出它的功能和运行结果。 #include
(213 lines deleted) 0
31
}; /*
*The string is a
* representation of the body * of this program from '0' * to the end */ main() {
int i ; printf(\ for(i=0;s[i];i++) printf(\ printf(\}
功能:以 int 和 string 形式输出同一个数组。从输出结果可以知道给同一个数组定义不同的类型将会输出不同的结果。 输出结果:
实验14
1..实验目的与要求
熟悉指针的正确用法。
5. 实验内容与步骤
(1) 调试下面程序,指出出现错误的原因。 main() {
32
int x=10,y=5,*px,*py; px=py; px=&x; py=&y;
printf(\}
调试结果: #include
运行结果:
第一个程序错误原因:缺少“#include
Which style you want to: Capital(c) or uncapital(u);u Computer
调试下面程序使其有如上执行结果 #include
错误信息:
33
调试后程序: #include
运行结果:
(2) 调试下面程序。 #include
float a; float*pa
scanf(\printf(\pa=&a;
scanf(\ printf(\}
调试后:
#include
34
{
float a; float*pa;
scanf(\printf(\pa=&a;
scanf(\ printf(\printf(\printf(\printf(\
printf(\} 运行结果:
(3) 调试下面程序。 #include
float a,b;
float*pa=&a,*pb=&b;
printf(\printf(\printf(\printf(\}
错误信息:
调试后程序: #include
float a,b;
float*pa=&a,*pb=&b;
printf(\printf(\
35