选择题 有以下程序:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
main()
{ char *p1,*p2;
p1=p2=(char*) malloc(sizeof(char)*10);
strcpy(p1,'malloc');
strcpy(p2,p1+1);
printf('%c%c\n',p1[0],p2[0]);
}
程序的运行结果是______。
选择题 有以下程序
main(int arge,char *argv[] )
int n,i=0;
while(argv[1] [i] !='\0')
{ n-fun(); i++;}
printf ( '%d\n' , n*argc.;
int fun ( )
{ static int s=0;
s+=1;
return s;
}
假设程序经编译、连接后生成可执行文件exam.exe, 若键入以下命令
exam 123 <回车>
选择题 有下列程序:
#include<stdio.h>
main()
{ int a=1,b=1,c=1;
if(a--||b----c)
printf('%d,%d,%d\n',a,b,c);
else
printf('%d,%d,%d\n',a,c,b);
}
程序执行后的输出结果是______。
选择题 有以下程序:
#include<stdio.h>
#define S(x)4*(x)*x+1
main()
{int k=5, j=2;
printf('%d\n', S(k+j));
}
程序运行后的输出结果是______。
选择题 若有声明“int a[]={1,2,3,4},*P,i;”,则以下程序段中不能输出13的是______。
选择题 有下列程序:
main()
{ int k=5;
while(--k) printf('%d', k=1);
printf('n');
}
执行后的输出结果是______。
选择题 有以下程序
#include<stdio.h>
int f(int n)
{ int t=0, a=5;
if(n/2){int a=6; t+=a++; )
else{int a=7; t+=a++; }
return t+a++;
}
main()
{ int s=0,i=0;
for(;i<2;i++) s+=f(i);
printf{'%d\n',s);
}
程序运行后的输出结果是______。
选择题 下面程序的输出结果是______。
#include<stdio.h>
main()
{int a[]={1,2,3,4,5,6,7,8,7,10},*p;
p=a;
printf('%d\n',*p+8);
}
选择题 对于一个正常运行的C程序,以下叙述中正确的是______。
选择题 若有以下程序
#include<stdio.h>
#include<stdlib.h>
#include<strinq.h>
typedef struct stu {
char*name,gender;
int score;
} STU;
void f(char *p)
{ p=(char *)malloc(10);
strcpy(p, 'Qian');
}
main()
{ STU a={NULL, 'm', 290}, b;
a. name=(char *)malloc(10);
strcpy(a.name,'Zhao');
b=a;
f(b.name);
b. gender='f'; b.score=350;
printf('%s,%c,%d,',a.name,a.gender,a.score);
printf('%s,%c,%d\n',b.name,b.gender,b.score);
}
则程序的输出结果是______。
选择题 有以下程序:
#include<stdio.h>
main()
{unsigned char a=2, b=4, c=5, d;
d=a | b;d=c; printf('%d\n',d);}
程序运行后的输出结果是______。
选择题有两个关系R和S,如下图所示:则由关系R得到关系S的运算是______。
选择题 下列字符数组初始化语句中,不正确的是______。
选择题 以下程序的输出结果是______。
#include<stdio.h>
main()
{int a=8,b=6,m=1;
switch(a%4)
{case 0:m++;break;
case 1:m++;
switch(b%3)
{ default:m++;
case 0:m++;break;}}
printf('%d\m',m);}
选择题 有以下程序
#include <stdio.h>
void main()
{
int n=2,k=1;
while(!(k>0||n++));
printf('%d %d\n',k,n);
}
程序运行后的输出结果是______。
选择题 以下结构体类型说明和变量定义中正确的是______。
选择题 有以下程序:
#include <stdio.h>
main()
{ char c1,c2;
c1='A'+'8'-'4';
c2='A'+'8'-'5';
printf('%c,%d\n',c1,c2);
}
已知字母A的ASCII码值为65,程序运行后的输出结果是______。
选择题 有以下程序
#include<stdio.h>
main()
{ char c;
do { c=getchar();
putchar(c);
} while(c!='#');
printf('\n');
}
执行时如输入:abcdefg##<回车>,则输出结果是______。
选择题 若有定义:int a=1234,b=-5678;,用语句printf('%+-6d%+-6d'a,b);输出,以下正确的输出结果是______。
选择题 下列程序段正确的是______。