Announcement

Collapse
No announcement yet.

hàm malloc

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • hàm malloc

    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;
    	}
    }

  • #2
    Bạn chỉnh sửa lại topic theo các yêu cầu đã nêu ra ở đây: http://forum.uit.edu.vn/threads/2676...-ve-lap-trinh-
    Đề nghị các bạn khác không trả lời topic này cho đến khi post #1 đã được điều chỉnh.

    Comment

    LHQC

    Collapse
    Working...
    X