I solved this simple question in C on my lab's system (which uses Windows). I used DevC++ to write this code and it ran on DevC++, but I cannot compile the same code on my Mac system.
Code:
#include<stdio.h>
#include<stdlib.h>
int* oddSwap(int x, int y)
{
int temp = x;
x = y * 5;
y = temp * 5;
int *k;
*k=x+y;
return k;
}
int main()
{
int x=5;
int y=3;
int *k=oddSwap(x,y);
printf("\n%d", *k);
return 0;
}
This ran on Windows (DevC++), but I'm getting this error message on running it on macOS (macOS 10.14.2).
Bus error: 10