P
pierozanetti
Hi,
I have a question. This statement is accepted by the g++ compiler (v.
4.1.2, under linux):
char c = 'a';
string s = s + c;
But the variable s is used before being defined! Why? It's correct?
The program aborts when the statement is reached.
If we change the above code into:
string s = s + 'a';
the error changes. A segmentation fault is raised.
Can anyone tell me why the code is accepted by the compiler?
Thanks
Piero Zanetti
I have a question. This statement is accepted by the g++ compiler (v.
4.1.2, under linux):
char c = 'a';
string s = s + c;
But the variable s is used before being defined! Why? It's correct?
The program aborts when the statement is reached.
If we change the above code into:
string s = s + 'a';
the error changes. A segmentation fault is raised.
Can anyone tell me why the code is accepted by the compiler?
Thanks
Piero Zanetti