I have this code:
Code:
#include <stdio.h>
main()
{
int a,b,c;
int *pa,*pb,*pc;
a = 10;
pa = &a;
printf("Value of a=%d, b=%d, c=%d\n",a,b,c);
printf("Address of a, b, c are %d %d %d\n",&a,&b,&c);
pb = &b;
*pb = *pa;
printf("Values of a=%d, b=%d, c=%d\n",a,b,c);
printf("Address of a, b, c are %d %d %d\n",&a,&b,&c);
*(--pb) = *pb;
printf("Values of a=%d, b=%d, c=%d\n",a,b,c);
printf("Address of a, b, c areu %d %d %d\n",&a,&b,&c);
}
This above code on Widows (DevC++) work, with only one code more on end [system("PAUSE")] to stop program before exit.
If I tray to compile this code at Linux (gcc -o address address.c) I get list of errors.
Code:
adresa.c: In function ‘main’:
adresa.c:13: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
adresa.c:13: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘int *’
adresa.c:13: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int *’
adresa.c:19: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
adresa.c:19: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘int *’
adresa.c:19: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int *’
adresa.c:24: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
adresa.c:24: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘int *’
adresa.c:24: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘int *’
Why is this happening and how to resolve this.