No output-only black console window

The output of the following C program is three integers-let us assume x,y,z.Find (x+y+z).

Please, you are informed that this C program can be compiled by turbo C compiler.

#include<stdio.h>
#include<conio.h>
   main()
   {
     int a=1;
     printf("%d\n%d\n%d\n",a,++a,a++);
     getch();
    }


The answer is 7.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Brian Moehring
Aug 23, 2018

The code has undefined behavior. The only solution is to download the same compiler as the poster and pray the version you get doesn't decide to execute the code in a different order on that particular day.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...