Whenever you declare an array as
int numbers[ 10 ];
you get the variable
numbers, which we can treat as if it were a pointer (since using its value gives you the address of the first element in the array), but the compiler knows it isn't really a normal pointer, because it addresses
actual memory somewhere in the computer.
If I were allowed to say:
1 2
|
int* returns_more_numbers();
numbers = returns_more_numbers();
|
this would cause a problem: we have the address of more numbers, but we have
permanently forgotten the address of the original array of numbers.
In order to prevent that, C and C++ make array variables
const. In otherwords, the array itself may be mutable, but the variable that addresses it is not.
int* const numeros = numbers;
Now we have created a new variable ('numeros') which is immutable (you can't change its value) just like 'numbers'. But, I can still mess with the contents of the array:
1 2
|
numeros[ 5 ] = -7;
numbers[ 7 ] = 42;
|
There is one important distinction though. The compiler knows the dimensions of 'numbers' but does not know the dimensions of 'numeros'.
You are trying to modify an array variable. Both
Title and
Director are array variables addressing existing arrays of characters.
So, what you need to do is
copy the data from the array
"Airplane"
to the array
Airplane.Title
.
You can use the
strcpy() function in <cstring>
1 2 3
|
#include <cstring>
...
strcpy( Airplane.Title, "Airplane" );
|
Or you can use the built in
char_traits copy function:
|
char_traits <char> ::copy( Airplane.Title, "Airplane", 9 );
|
Or you can use STL algorithms to copy it:
1 2 3
|
#include <algorithm>
...
copy_n( "Airplane", 9, Airplane.Title );
|
(Hmm, come to think of it,
copy_n() is relatively new. Your compiler might not have it...)
Hope this helps.