Posted November 30, 2009
I'm having an exam tomorrow... C language... I am having a little problem understanding the logic of this program. Can anyone explain me how the things are calculated? In particular, the j variable. I don't understand how it becomes 20.
#include <stdafx.h>
#include <stdio.h>
#define A 5
#define MACRO(j,i) i=j/i
#define PR printf("i=%d, j=%d, k=%d\n",i,j,k);
void main()
{
int i=8,j=2,k;
int kraj;
k=MACRO(i,j)*A;
PR;
j/=A;
k+=MACRO(++j*A,i);
PR;
scanf_s("%d",&kraj);
}
#include <stdafx.h>
#include <stdio.h>
#define A 5
#define MACRO(j,i) i=j/i
#define PR printf("i=%d, j=%d, k=%d\n",i,j,k);
void main()
{
int i=8,j=2,k;
int kraj;
k=MACRO(i,j)*A;
PR;
j/=A;
k+=MACRO(++j*A,i);
PR;
scanf_s("%d",&kraj);
}
Post edited November 30, 2009 by KavazovAngel
This question / problem has been solved by Barefoot_Monkey