i would like to create a function which takes in a reference to a pointer.for some reason when i build this, I keep getting cout and endl undeclared identifier.
i am also getting some warning initializing truncation from char to int.
The error you encountered is due to usingnamespace std; coming after the 'display' function, so the contents of the std namespace are not available there. Moving line 15 to above line 5 fixes this specific error.
There are warnings about line 19, though.
1 2 3 4 5 6 7 8 9 10 11
test.cpp:19:21: warning: multi-character character constant [-Wmultichar]
char loaded2[] = { 'aa', 'BB' };
^
test.cpp:19:27: warning: multi-character character constant [-Wmultichar]
char loaded2[] = { 'aa', 'BB' };
^
test.cpp: In function ‘int main()’:
test.cpp:19:32: warning: overflow in implicit constant conversion [-Woverflow]
char loaded2[] = { 'aa', 'BB' };
^
test.cpp:19:32: warning: overflow in implicit constant conversion [-Woverflow]
The first two are reported because a character constant (inside 's) is meant to be a single character. The last two, if I understood it correctly, say that both values (that the compiler is probably treating as a 2-byte integer) get truncated to fit the char type, which is 1-byte long on most platforms.