题目内容

#include <stdio.h>
#include <stdlib.h>
void getmemory(char *p)
{
p=(char *) malloc(100);
strcpy(p,"hello world");
}
int main()
{
char *str=NULL;
getmemory(str);
printf("%s/n",str);
free(str);
return 0;
}
程序崩溃,getmemory中的malloc 不能返回动态内存, free()对str操作很危险
5.char szstr[10];
strcpy(szstr,"0123456789");
产生什么结果?为什么?

查看答案
更多问题

死锁的处理

ISO的七层模型是什么?tcp/udp是属于哪一层?tcp/udp有何优缺点?

二、位域的使用位域的使用和结构成员的使用相同,其一般形式为: 位域变量名?位域名 位域允许用各种格式输出。

求函数返回值,输入x=9999;
int func (x )
{
int countx = 0;
while (x )
{
countx ++;
x = x&(x-1);
}
return countx;
}
结果呢?

答案查题题库