i am computer newbie, i use linux for my work, i wanna learn c programming language, but i have warning with compailing on linux, please tell me about pointer variable on linux,
example code
Code:
#include <stdio.h>
void rischan(int a, int * b);
int main(void) {
int x;
int *y;
x=2;
y=&x;
printf("Address of x = %d, value of x = %d\n", &x, x);
printf("Address of y = %d, value of y = %d, value of *y = %d\n", &y, y, *y);
rischan(6,y);
}
void rischan(int a, int *b){
printf("Address of a = %d, value of a = %d\n", &a, a);
printf("Address of b = %d, value of b = %d, value of *b = %d\n", &b, b, *b);
}
the warning like this
Code:
c.c: In function ‘main’:
c.c:11: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
c.c:12: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int **’
c.c:12: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘int *’
c.c: In function ‘rischan’:
c.c:17: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
c.c:18: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int **’
c.c:18: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘int *’
please tell me...why...?..thanks, and iam sorry my english is poor...