• closed by
416 views
0 0 votes
closed as a duplicate of: Undefined Behaviour in C
what is the ouput of this code ?

main()

{

int x = 10;

int y = (++x) + (--x);

printf(“%d”,y);

}

 

and i am confuse about this code specifically about this expression int y = (++x) + (--x);

so if this expression is wrong so what the wrong about this expression and topic related to “Precedence and associativity”
Position:
Show:

Related questions

0 0 votes
1 1 answer
501
501 views
shivamSK asked Jun 19, 2024
501 views
#include <stdio.h void f(int (*x)(int)); int myfoo(int i); int (*foo)(int) = myfoo; int main() { f(foo(10)); } void f(int (*i)(int)) { i(11); } int myfoo(int i) { printf(...
1 1 vote
0 0 answers
687
687 views
shivamSK asked Jun 19, 2024
687 views
#include <stdio.h void f(int (*x)(int)); int mysh(int); int (*sh)() = mysh; int main() { f(sh); sh++; for(int x=sh;x>=0;x ){ if(x){ printf("i am here"); }else{ printf("yo...
0 0 votes
1 1 answer
468
468 views
shivamSK asked Jun 9, 2024
468 views
#include <stdio.h double pom(double x,int n){ if(n==1) return x; else return x*pom(x,n-1); n; } int main() { int a=pom(2,5); printf("%d",a); return 0; }what is the outpu...
1 1 vote
1 1 answer
395
395 views
shivamSK asked Jun 9, 2024
395 views
what is output of this c codeA: 321B: 123C: error(infinite/segmentation)D:333