dimanche 29 mars 2015

c programming language macros , postfix and prefix increment, results in windows dos and codeblocks




#include <stdio.h>
#include <stdlib.h>

#define comp(a,b) ((a)*(a)+(b)*(b))

void main(void){
int x=1;
int y=2;
int z=comp(x++,++y);
printf("x = %d \ny= %d\nz= %d\n",x,y,z);
system("pause");
}


output on windows dos .. when use notepad and gcc compilor directly x=3 ,y=4,z=17 output with same code compiled on codeblocks is x=3 ,y=4,z=18 please help me .. i want to know steps code will do .. i am beginner .




Aucun commentaire:

Enregistrer un commentaire