+ 1
Hey can u tell me why output is 5
#include <stdio.h> int main() {int i =(1,2,3,4,5); printf("%d",i); return 0;} Thanks in advance
4 Respuestas
+ 4
Yes I can with use of google 😂:
'()' operator has higher precedence than '='. So , firstly, bracket operator is evaluated. '()' operator is operated from left to right. but it is always the result of last that gets assigned.
https://stackoverflow.com/questions/17251584/difference-between-int-i-1-2-3-and-int-i-1-2-3-variable-declaration-with
+ 2
Intially i=1then it changes to 2,then3,then4,then 5.
So at last ,last value assigned to i.but if there is no parenthesis then i=1;