Code:
while ((_char = getchar()) != '\0')
{
/* some function here */
current -> character = _char; /* error : assignment makes pointer
To expand on this, both the top and bottom line here are incorrect. You need to dereference the pointer to assign a value to what it points to. Otherwise, you need to assign an address to it. Remember that pointers are variables whose value they hold is an address. Thus:
The value this holds is an integer. (1, 345, -23, whatever)The value this holds is the address of another integer. So the only thing you can assign this is another pointer to an integer, or the address of a non-pointer integer. Like so:
Code:
int x;
int *ptr;
int *pt2;
ptr = &x; /* The address of a non-pointer integer... */
pt2 = ptr; /* The value of another pointer... (ie: the address the other pointer contains) */
So reading the above, can you figure out what's wrong with those two lines?
Quzah.