Example code for how to allocate memory in c for an integer pointer:
What is the output of below c program?
int *p = malloc(sizeof(int));
*p = 100;
100, garbage value
100, and crash.
it prints 100, 101. *p will get the value of that pointer. ++*p will increment the value located at the address held by p.
Back To Top