一般c语言面试题:,C++程序,[]=“abcd”char*p=str;intn=10;sizeof(str)=__sizeof(p)=__sizeof(n)=__voidFoo(charstr[100]){sizeof(str)=__}void*p=malloc(100);sizeof(p)=,如何改进(1):voidtest1(){ charstring[10]; char*str1="0123456789"; strcpy(string,str1);}(2):voidtest2(){ charstring[10],str1[10]; inti; for(i=0;i<10;i++){ str1[i]='a'; } strcpy(string,str1);}(3):voidGetMemory(char*p){ p=(char*)malloc(100);}voidTest(void){ char*str=NULL; GetMemory(str); strcpy(str,"helloworld"); printf(str);},给定结构structA{chart:4;chark:4;charu;unsignedshorti:8;unsignedlongm;};问sizeof(A)=__如果把上述定义改成:structA{chart:5;chark:4;charu;unsignedshorti:8;unsignedlongm;};sizeof(A)=:typedefunion{longi;intk[5];charc;}DATE;structdata{intcat;DATEcow;doubledog;}too;DATEmax;则语句printf("%d%d",sizeof(structdata),sizeof(max));的执行结果是:“标准”宏MIN,??如何判断一颗树是平衡二叉树??
程序员面试题 来自淘豆网m.daumloan.com转载请标明出处.