سؤال

Why compiler ignores increment operation? Version of gcc is 3.3. IDE: Eclipde

Program code:

// File t.cc
#include <stdio.h> 
int main (void)
{
  int x = 1;
  x++; // ? 
  printf ("x=%d\n", x);  
  return 0;
}

Running the program:

$ g++ -ansi t.cc
x=1
هل كانت مفيدة؟

المحلول 2

Your code returns x value as 2. Re-compile & execute again.

enter image description here

نصائح أخرى

Your compiler is broken. A fix for this would be to get a new one.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top