Why is dangerous to run this?

I have an exam tomorrow and one of the question from the review is to explain it is dangerous to run a program with this part of the code and what could happen?

char *myPtr;
*(myPtr + 2) = '0';
myPtr has undefined value because it was not initialized or assigned. So the code

*(myPtr + 2) = '0';

has undefined behaviour. Where character '0' will be written?

Topic archived. No new replies allowed.