Is this pseudo-code? Because the following line,
Main (void)
should be changed to,
int main (void)
Then the rest of the program would compile and show the output that you want. But first, there are a few changes that you might want to make. Have a look at the following program (without compilation errors),
#include <stdio.h>
#define print(a) printf("%d\n",a) // Removed the spaces.
int a;
void A (int p)
{
p += a; print (p);
}
void B(int *q)
{
int p = *q + 3; A (a);
*q = a - 2;
print (a);
}
int main (void)
{
a = 6;
B(&a);
print(a);
}
The changes made were that you should avoid adding spaces to the macro, it expects that the right-part has started, or so. Secondly, C/C++ programs should be ASCII (or Unicode in the case of strings only), and it you don't use that encoding, compiler will complain. I recommend
learn the basics of C programming first[
^]. Also, if you want to share such programs in future, please create an online C/C++ fiddle at cpp.sh, like this,
C++ Shell[
^]
If that was not the expected output, please have a look at the logic of your program.