0
Is there a way this could work?
3 Antworten
+ 6
add columns
int x = (1, 2, 3); // x = 3
or if you want array
int x[] = {1, 2, 3};
0
Why does x = (1,2,3) takes the last value? i.e x = 3
0
Because ',' is working in different way than in functions - it process first part, than second - it's priority in operators is last, so you have to add columns because 2 and 3 aren't correct name for intager (can't start with number), normaly ',' is used to declare more variables at time
int x = 5, y = 7; // creates two intagers, x and y
here you can see it:
https://code.sololearn.com/c8Aw5E9nwM2l/?ref=app