Originally Posted by
ozumsafa
But I did array=malloc(10*sizeof(char)) before I printed the sizeof(*array) .. Dint I allocate a 10 char memory to array ? So shouldnt it print out 10??
But Is it because When I do that I set a 10 lenght string and the array points to the first component of the string and that is 1 byte?
Also I wonder :
>char *array=malloc(10*sizeof(char));
>gets(array);
I deliberately use gets to lead program to an error. But I enter an input more than 10 character , it does not give error. What is the problem. I think I couldnt get what malloc does..