Post: hàm malloc
User: 12520587
Infraction: Ngôn từ không phù hợp/không dấu
Points: 1
Administrative Note:
Message to User:
Original Post:
User: 12520587
Infraction: Ngôn từ không phù hợp/không dấu
Points: 1
Administrative Note:
Đọc kỹ trước khi post bài: http://forum.uit.edu.vn/threads/26761-Phai-doc-truoc-khi-tao-thread-Mot-so-quy-tac-khi-hoi-cac-van-de-ve-lap-trinh-
Message to User:
Đọc kỹ trước khi post bài: http://forum.uit.edu.vn/threads/2676...-ve-lap-trinh-
Original Post:
chương trình này bị lỗi gì vậy?
HTML Code:
#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> int main() { printf("nhap vao mot so:\t"); char *aa; aa=(char *)malloc(100); if(aa==NULL) { printf("error\n"); getch();exit(1); } else { aa="hello!"; char *ac; ac="welcome!"; printf("str1:%s\nstr2:%s",aa,ac); strcpy(aa,ac); printf("%s\n",aa); getch(); return 0; } }