Hi guys im getting
In function `getMonth':
cal.c:40: warning: int format, unsigned int arg (arg 3)
cal.c:45: warning: comparison between pointer and integer
cal.c:45: warning: comparison between pointer and integer
Is that possible because of im passing the variables wrong through the function or because im reading it from fscanf wrong?
Code:int main(void) { unsigned int month, year; getMonth(&month); return EXIT_SUCCESS; } /**************************************************************************** * Function getMonth() prompt the user for a number MIN_MONTH to MAX_MONTH and * returns that number. The number 0 is valid because this indicates that the * user wants to select all months. ****************************************************************************/ unsigned getMonth(unsigned int *month) { /*** declare variables*/ int arr[31]; int month_days [] ={31,28,31,30,31,30,31,31,30,31,30,31}; printf("Please enter a month between 0 - 12\n"); fscanf(stdin, "%d", month); /* validation check if month entered is less then 0 > 12*/ while(1) { if(month<1 || month>12) { printf("error wrong month input between 0-12\n"); break; } } return EXIT_SUCCESS; }



LinkBack URL
About LinkBacks


