struct and pointers

I have a variable (Mydict) which is struct type, which includes a pointer (dict0) to an array of chars (5 of them). now I want to assign a word to that array and can't figure out how to do it.
I can't change the lines in the struct definition itself so I need to know how to write the last line correctly (the one that's supposed to assign "olga" to the array.

If you don't want to use the temporary variable you can also use the typecast

Mydict.dict0 = (char(*)[5])&buffer;

But this looks quite ugly to me.

I don't see why you cannot just write:

Code:

Mydict.dict0 = &buffer;

since buffer is a char[5], hence &buffer is already a char(*)[5].

Originally Posted by Bjarne Stroustrup (2000-10-14)

I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.