Em có đoạn code sau :
Cứ chạy tới hàm free la nó báo lỗi em không hiểu tại sao cả ạ !
Code:
# include <stdio.h> # include <stdlib.h> # include <conio.h> void main () { int *num, i,j=0; printf ("Enter the number of element : \n"); scanf("%d",&i); num=(int *) malloc (i*sizeof(int)); printf ("\nEnter data\n "); for (j=0;j<=i;j++) { scanf("%d",(num+j)); } printf("\n"); for (j=0;j<=i;j++) printf("%d\t",*(num+j)); getch(); free(num); }
Comment