जब मैं यह कोड चलाता हूं।सी में परिवर्तनीय पते कैसे मुद्रित करें?
#include <stdio.h>
void moo(int a, int *b);
int main()
{
int x;
int *y;
x = 1;
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);
moo(9, y);
}
void moo(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);
}
मुझे यह त्रुटि मेरे कंपाइलर में मिल रही है।
/Volumes/MY USB/C Programming/Practice/addresses.c:16: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
/Volumes/MY USB/C Programming/Practice/addresses.c:17: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int **’
/Volumes/MY USB/C Programming/Practice/addresses.c:17: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘int *’
/Volumes/MY USB/C Programming/Practice/addresses.c: In function ‘moo’:
/Volumes/MY USB/C Programming/Practice/addresses.c:23: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int *’
/Volumes/MY USB/C Programming/Practice/addresses.c:24: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘int **’
/Volumes/MY USB/C Programming/Practice/addresses.c:24: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘int *’
क्या आप मेरी मदद कर सकते हैं?
धन्यवाद
blargman
वे "चेतावनी" कहते हैं, "त्रुटि" नहीं। इसका मतलब है कि आपका प्रोग्राम अभी भी चलाएगा। लेकिन नीचे दिए गए उत्तर के अनुसार चेतावनियों को ठीक करें। –