#include<stdio.h>
int main(void)
{
const int a = 6;
int* const ptr = &a;
*ptr = a*a;
printf(" a= %d ptr = %d ", a, ++ *ptr);
printf(" a= %d ptr = %d ", a, -- *ptr);
return 0;
}
Above is the program I'm referring to.
For me the output, I'm getting is no. 1)
- a = 6 ptr = 37 a= 6 ptr = 36
- a = 37, ptr = 37 a = 36, ptr = 36
If I'm using an online editor I'm getting output no. 2). My instructor too showed me the output as no. 2), it is a windows system and has MingW installed in it. How is that so ? I decided to go for MacBook Pro for programming after many research. Also through pen and paper the output is 2). What changes I need to make to this code to get the same output as no. 2) ?
Can anyone please help me with this ? Also what other precautions I need to take while using Mac, if MingW is not installed ?
Thanks in advance.
Tried to run on Mac using Visual basic IDE however the outputs on Mac and Windows are different.