Re: A89: Re: C problem...


[Prev][Next][Index][Thread]

Re: A89: Re: C problem...




Hi!

| > > Instead of increasing the pointer that you pass as a parameter with
| > >  'initials++', let that pointer stay the same, and use
| > '*initials[count]=key'
| > >  instead of '*initials=key'.  Since C is a high-level programming
language,
| > >  you shouldn't have to mess around with pointers that much.
| >
| > When I try this the compiler says "invalid type argument of 'unary * '
| > "...why does it say this?
|
| Because "*initials" isn't an array, but "initials" is. Use
"initials[count] =
| key" instead.
| In C the variable you use as an array name is in reality a pointer to a
memory
| area with the array's element types in order.

Read further on in my email about the other modifications you have to make:
If you pass '&initials' to the function as a parameter, you have to declare
the parameter as an array.  Otherwise, if you don't pass it to the function
at all, but use the global variable, leave the '*' away.

Bye,

Sebastian




References: