文本描述
西安恺壹软件 初级软件工程师 笔试题
int a = 5,b = 7,c;
c = a ++ + b;
求abc的值:a = 6, b = 7, c = 12.
Void fun(int *p)
{
Int = 10;
P = &a
++ *p;
}
Main()
{
Int a= 5;
Fun(&a);
Printf(“%d\n”, a);
}
程序改错题,请找出程序中的错误 :
程序1:
#include
#include
#include
void GetMem(char **p, int num)
{
*p = (char *)malloc(num);
}
int main(void)
{
char *str = NULL;
GetMem(&str, 10);
strcpy(str, “hello world”);
Printf(“%s\n”, str);
return 0;
}
程序2:
#include
int main(void)
{
int a[3][3] = {1,2,3,4,5,6,7,8,9};
int i;
for (i =1; i <= 3; i++)
{
printf(“%d\n”, a[i][i]);
}
return 0;
}
写出水仙花程序
写一个程序读取10 x 10个二维数组数据,并且用一个一维数组保存每一行的平均值,并打印该一维数组。
给定结构struct A{ char t; char k; unsigned short i; unsigned long m;};问sizeof(A) = ?
写出TCP模型和ISO模型,并写出他们之间的对应关系。
main(){ int a[5]={1,2,3,4,5}; int *ptr=(int *)(&a+1); printf(“%d,%d”,*(a+1),*(ptr-1));}请问输出:1,2,1 2, 2,5 3,其他
9.解释一下函数的作用:
int fun(int x, int n)
{int val = 1;if (n > 0)
{if(n % 2 == 0)
val *= x;
val = x * x * fun(x,n/2);
}
Return val;
}
1.n^x 次幂 2,x^n次幂 3.x*n 4都不是
10. *str=”0123456789”
Sizeof(str) =___
Sizeof(*str)=___