I made this program in C and I am getting an error I don't know how to fix. Please help me find the error. This is the code I wrote:
#include <stdio.h>
int main(int argc, char *argv[]){
int x = 98;
int *g = x;
printf("This is x: %d, and this is g: %i.\n", x, *g);
*g=45;
printf("This is x: %d, and this is g: %i.\n", x, *g);
return 0;
}
The compiler gives me the following errors:
ex15t.c: In function ‘main’:
ex15t.c:5:12: warning: initialization makes pointer from integer without a cast [enabled by default]
Thanks ahead for any help.