I want to initialize the array car.places[2][3] but there's always zero in the array. Please can someone tell me what I´m doing wrong, here is the code:
#include <iostream>
#include <string>
using namespace std;
class reserv
{
public:
int places[2][3];
} car;
int main () {
car.places[2][3] = (
(1, 2, 3),
(4, 5, 6)
);
for(int i=0;i<2;i++)
{
for(int j=0;j<3;j++)
{
cout << i << "," << j << " " << car.places[i][j] << endl;
}
}
return 0;
}
I get this warning form the compiler:
>g++ -Wall -pedantic F_car_test.cpp
F_car_test.cpp: In function 'int main()':
F_car_test.cpp:16:11: warning: left operand of comma operator has no effect [
-Wunused-value]
(1, 2, 3),
^
F_car_test.cpp:16:14: warning: right operand of comma operator has no effect
[-Wunused-value]
(1, 2, 3),
^
F_car_test.cpp:17:11: warning: left operand of comma operator has no effect [
-Wunused-value]
(4, 5, 6)
^
F_car_test.cpp:17:14: warning: right operand of comma operator has no effect
[-Wunused-value]
(4, 5, 6)
^
Thanks in advance,