What are the differences in using malloc or not using it in this code?
What is the difference if you were to do this:
char* memory = malloc(sizeof("String"));
memory = "String";
printf("%s", memory);
free(memory); //edit
Or this:
char* noMemory = "String";
printf("%s", noMemory);
No comments:
Post a Comment