|
|
|
|
|
by NotSammyHagar
3522 days ago
|
|
Get out would be rude. If you interview a lot of people who say they are programmers, you get people who can't do anything sometimes. It is frustrating perhaps but that's no reasonable way to treat people. Back to the question. In C or C++ the pointer is pointing to a memory location. If you don't set it to something (ie no malloc, or assignment, then it is uninitialized and you can't use what it points to. It is essentially a random number. Looking at a random memory location "(* p)" could likely crash your program, but it won't be anything useful that you should use. So when you say "* p" = 'c'; you say overwrite the memory location (which is randomly chosen) with the ascii code for the character 'c'. Side note - the surprising markup language here doesn't let you use asterisk p directly, you have to put a space in I just discovered. |
|