I have a query regarding the dynamic memory allocation of a integer pointer.
int main()
{
int *a;
*a = 5;
printf("value = %d\n", *a);
return 0;
}
As per my understanding, the above piece of code should return segmentation fault, which happening in my PC (Ubuntu 32bit).
But the same piece of code, when executed on my MacOS and a Fedora Linux system gives output as "value = 5". Any idea, why this code is working on these two systems, even when I have not allocated memory for integer pointer?