相关题目
有以下程序
#include
fun(int n, int *s)
{ int f1, f2;
if(n==1||n==2)
*s=1;
else
{ fun(n-1, &f1);
fun(n-2, &f2);
*s=f1+f2;
}
}
void main()
{ int x;
fun(6, &x);
printf("%d\n", x);
}
执行后的输出结果是( )。
有以下程序
#include
void fun(int *s)
{ static int j=0;
do
{ s[j]+=s[j+1];
}while(++j<2);
}
void main()
{ int k,a[10]={1,2,3,4,5};
for(k=1;k<3;k++)
fun(a);
for(k=0;k<5;k++)
printf("%d",a[k]);
}
执行后的输出结果是( )。
有以下程序
#include
void fun (char*c,int d)
{*c=*c+1;d=d+1;
printf("%c,%c,",*c,d);
}
void main()
{char b='a',a='A';
fun(&b,a); printf("%c,%c\n",b,a);
}
执行后的输出结果是( )。
有以下程序
#include
void main()
{ int b[3] [3]={0,1,2,0,1,2,0,1,2},i,j,t=1;
for(i=0; i<3; i++)
for(j=i;j<=i;j++) t+=b[i][b[j][i]];
printf("%d\n",t);
}
执行后的输出结果是( )。
有以下程序
#include
void fun(int *x,int i)
{*x=*(x+i);}
void main()
{ int a[8]={1, 2, 3, 4, 5, 6, 7, 8},i;
fun(a,2);
for(i=0; i<8/2; i++)
{ printf("%d",a[i]);}
printf("\n");
}
执行后的输出结果是( )。
有以下程序
#include
int fun()
{static int x=1;
x*=2; return x;
}
void main()
{int i,s=1;
for (i=1;i<=2;i++) s=fun();
printf("%d\n",s);
}
执行后的输出结果是( )。
有以下程序
#include "stdio.h"
#include "string.h"
void main( )
{ char str[100] ="How do you do";
strcpy( str + strlen(str)/2, "es she");
printf("%s\n", str);
}
执行后的输出结果是( )。
有以下程序
#include "stdio.h"
f(char *s)
{ char *p=s;
while(*p!='\0')
p++;
return(p-s);
}
void main()
{ printf("%d\n",f("ABCDEF"));
}
执行后的输出结果是( )。
有以下程序
#include "stdio.h"
#include "string.h"
void main( )
{ char s1[50]={"some string *"},s2[]={"test"};
printf("%s\n", strcat(s1,s2));
}
执行后的输出结果是( )。
有以下程序
#include "stdio.h"
void main( )
{ int a[4][5]={1,2,4,-4,5,-9,3,6,-3,2,7,8,4};
int i,j,n;
n=9;
i=n/5;
j=n-i*5-1;
printf("a[%d][%d]=%d\n", i,j,a[i][j]);
}
执行后的输出结果是( )。
