What does parantheses do in this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does parantheses do in this code

#include<stdio.h> int main() { Int a,x=(2,3,4,5); a=1,2,3,4,5; Printf("%d%d",x,a); return 0; }

14th Sep 2020, 3:03 PM
Anusha
Anusha - avatar
1 Answer
+ 3
With parentheses, the comma operator is in effect. https://docs.microsoft.com/en-us/cpp/cpp/comma-operator?view=vs-2019 For expression (a, b), a is evaluated, and then b is evaluated. The value of b is returned for the entire statement. Without parentheses, the assignment operator takes precedence over the comma operator, assigning 1 to a.
14th Sep 2020, 3:16 PM
Hatsy Rei
Hatsy Rei - avatar