Hi guys im trying to compile this code in ansi c and i keep getting a warning when using the printf statement when trying to print the phone number from the struct it gives me a
warning: int format pointer arg what am i doing wrong in the printf statement
Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define PHONEMAX 9
#define AGEMAX 20
#define ADDRESSMAX 30
void flush_stdin();
struct personDetails
{
int phone [PHONEMAX];
int age [AGEMAX];
char gender;
char address [ADDRESSMAX];
};
int main (void)
{
int valid;
struct personDetails pd;
do
{
printf("please enter an integer phone number\n\n!");
if((fscanf(stdin, "%d", pd.phone)==1))
{
printf("you have entered an int\n\n");
valid = 1;
}
else
{
flush_stdin();
valid = 0;
}
}
while(!valid);
printf("Your phone number is:%d", pd.phone);
return EXIT_SUCCESS;
}
/* begin of flush_stdin 05-8-31 19:30 */
void flush_stdin( void )
{
if ( !feof(stdin) ) {
int c;
while( ( c=getchar() ) != '\n' && c != EOF )
;
}
} /* end of flush_stdin */