Some of these declarations are bad:
Code:
int main() {
char c = 'a';
int ia[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
char* sa[3] = {"tic", "tac", "toe"};
char* pc = &c; // ptr to `char'
int& ir = &ia; // reference to array of ten `int's (?)
char* psa[] = sa; // ptr to array of character strings (?)
char** ppc = &pc; // ptr to ptr to `char' (?)
const *int ci = 5; // ptr to `const int' (?)
int *const pci = &ci; //`const' ptr to `int' (?)
}
I'm having trouble with the items with question marks.
Output:
Code:
decs.cc: In function `int main()':
decs.cc:8: invalid conversion from `int (*)[10]' to `int'
decs.cc:8: initialization of non-const reference type `int&' from rvalue of
type `int (*)[10]'
decs.cc:9: invalid initializer
decs.cc:12: syntax error before `int'
Thanks for your help!