My professor is having us define methods (which he has provided the headers for), and they take in:
as a parameter.Code:char *indicator
This is a pointer named "indicator" of type char... right? The problem is that in the problem he refers to it as a string. "Take the 4th character in indicator and (do action)" So apparently, somehow in his test program he makes one character in to an array of characters (a string)?
So I manipulate it as an array of characters.... but I just get confused. My code works, but I want to understand the logic behind it. How does one char suddenly become an array of chars? Furthermore, if I want to get the 4th character in the "string", why would I use
(which gives me an error)Code:*indicator
Doesn't using the variable name without the "*" give me an address? Won't I have to dereference it to get the actual char?
Another problem asks us how to go about getting the memory address of indicator. Would I then use "*indicator"?
I'm just confused... someone help?