#include #include void foo(int age,char *b) { b = (char *)malloc(64); sprintf(b,"Your Age is %d",age); } int main() { char *f; foo(23,f); printf("%s\n",f); } 看不明白哪错了?
by culuckyabcd - C/C++ - 2011-07-13 11:21:30 阅读(13400) 回复(39)
#include
#include
请指出下列程序中的错误并且修改 void get_memory(char *p, int size) { p = (char *)malloc(size); } void test(void) { char *str = NULL; get_memory(str, 100); strcpy(str, "hello world"); printf(str); }
转来的。
真的别笑,现在学校里教的是这个。
1、试找出程序中的语法错误,写出错误所在行号及正确内容。
#include
下面有错误,在那里,怎么改正 int main(){ ... // other codes pthread_mutex_init(&Mutex1, NULL); pthread_mutex_init(&Mutex2, NULL); pthread_mutex_init(&Mutex3, NULL); pthread_create(&thread1, NULL, (void *) Thread1, NULL); pthread_create(&thread2, NULL, (void *) Thread2, NULL); ... // other codes } void Thread1(){ pthread_mutex_lock(Mutex1); pthread_mutex_lock(Mutex3); pthread_mutex_lock(Mut...
第一,谈谈final, finally, finalize的区别。 第二,Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)? 第三,Static Nested Class 和 Inner Class的不同,说得越多越好(面试题有的很笼统)。 第四,&和&&的区别。 第五,HashMap和Hashtable的区别。 第六,Collection 和 Collections的区别。 第七,什么时...
第一,谈谈final, finally, finalize的区别。 第二,Anonymous Inner Class (匿名内部类) 是否可以extends(继承)其它类,是否可以implements(实现)interface(接口)? 第三,Static Nested Class 和 Inner Class的不同,说得越多越好(面试题有的很笼统)。 第四,&和&&的区别。 第五,HashMap和Hashtable的区别。 第六,Collection 和 Collections的区别。 第七,什么时候用assert。 第八,GC是什么? 为什么要有GC? 第九,String s ...
面试官:知道什么叫类么? 应聘者:我这人实在,工作努力,不知道什么叫累。 面试官:知道什么是包? 应聘者:我这人实在 平常不带包 也不用公司准备了。 面试官:知道什么是接口吗? 应聘者:我这个人工作认真。从来不找借口偷懒。 面试官:知道什么是继承么? 应聘者:我是孤儿没什么可以继承的。 面试官:知道什么叫对象么? 应聘者:知道,不过我工作努力,上进心强,暂时还没有打算找对象。 面试官:知道多态么? 应聘者...