+ 2

could anyone tell me what is the error for that piece of code..why it says that b and c are not declared??!

#include <iostream> using namespace std; int main() { char a[3]={a,b,c}; cout<<a[1]; return 0; }

7th Sep 2017, 12:06 PM
RiGeL
RiGeL - avatar
4 Respuestas
+ 2
@ Enzo thank you
7th Sep 2017, 12:28 PM
RiGeL
RiGeL - avatar
+ 2
@aklex thank you
7th Sep 2017, 12:28 PM
RiGeL
RiGeL - avatar
+ 1
Because you didn't declare b or c. The compiler is expecting them to be variables. I think what you are trying to is this: char[3] = {'a', 'b', 'c'};
7th Sep 2017, 12:16 PM
aklex
aklex - avatar
0
it thinks your talking about variables, put quotations marks around the letters.
7th Sep 2017, 12:16 PM
Enzo
Enzo - avatar