797 views
1 votes
1 votes
#include<stdio.h>
int x = 0;  
int f1() { 
  x = 5; 
  return x; 
}  
int f2() { 
  x = 10; 
  return x; 
} 
int main() { 
  printf("%d \n", f1()); 
    printf("%d \n", f2()); 
  int p = f1() + f2(); 
  printf("%d ", x); 
  return 0; 
}

what is the output when int p= f1()+f2(); is called and how this is came??????

thank you…!

1 Answer

0 votes
0 votes
Yupp...There will be no change in x .

f1() and f2 () are only called they are returning the values but they can't change the value of x . If there would be any local variable x and initialized in main function then that value could have printed.

Related questions

2 votes
2 votes
0 answers
2
kapil pandey asked Sep 29, 2016
527 views
how (a+++b) evaluated, either (a++) +b or a+(++b)
2 votes
2 votes
0 answers
3
Balaji Jegan asked Dec 6, 2018
662 views
Please arrange the below operators in increasing order of their precedence. Also please state their associativity.↔→$\equiv$$∧$$∨$$¬$
1 votes
1 votes
0 answers
4
Akash Mishra asked Jan 22, 2018
354 views
What would p++ - c be?(p++) - cor(p - c)++Please provide an explanation.