Whats the problem with int *p=23;
- by piemesons
Yesterday in my interview I was asked this question. (At that time I was highly pressurized by so many abrupt questions).
int *p;
*p=23;
printf('%d',*p);
Is there any problem with this code?
I explained him that you are trying to assign value to a pointer to whom memory is not allocated.
But the way he reacted, it was like I am wrong. Although I got the job but after that he said Mohit think about this question again.
I don't know what he was trying to say. Please let me know is there any problem in my answer?