so I'm quite new in this, sorry if it sound like a dumb question
I'm trying to understand malloc, and create a very simple program which will print "ABC" using ASCII code
here is my code (what our professor taught us) so far
char *i;
i = malloc(sizeof(char)*4);
*i = 65;
*(i+1) = 66;
*(i+2) = 67;
*(i+3) = '\0';
what I don't understand is, why do I have to put malloc there? the professor told us the program won't run without the malloc, but when I tried and run it without the malloc, the program run just fine. so what's the function of malloc there? am I even using it right?
any help and or explanation would be really appreciated