Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
#include <stdio.h>

struct date {
        int year;
        int month;
        int day;
    };

void readDate(struct date *);
void readDate(struct date *dateptr)
{
printf("\n Enter a new date:\n");
printf("year:");
scanf("%d",&(*dateptr).year);
printf("month:");
scanf("%d",&(*dateptr).month);
printf("day:");
scanf("%d",&(*dateptr).day);
};
void printDate(struct date);
{printf("%d0%d%d\n",date.year,date.month,date.day);
};
int main(void) {
	struct date today;
	readDate(&today);
	printDate(today);
	return 0;
}


What I have tried:

I don't understand what should i do to solve this error.Please someone help me.
Posted
Updated 4-Apr-21 0:04am
Comments
gggustafson 4-Apr-21 11:15am    
What's the semicolon doing after void printDate(struct date); ? If the compiler had continued, it would have complained about printDate(today); because printDate is not defined.

1 solution

Quote:
I don't understand what should i do to solve this error.Please someone help me.

The error message means that your code is not C anymore when compiler reached the position of error.

Pay attention to semicolons, there are rules to where to put them.
Beautifiing code may help to read:
C++
#include <stdio.h>

struct date {
    int year;
    int month;
    int day;
};

void readDate(struct date * );
void readDate(struct date * dateptr) {
    printf("\n Enter a new date:\n");
    printf("year:");
    scanf("%d", & ( * dateptr).year);
    printf("month:");
    scanf("%d", & ( * dateptr).month);
    printf("day:");
    scanf("%d", & ( * dateptr).day);
};
void printDate(struct date); {
    printf("%d0%d%d\n", date.year, date.month, date.day);
};
int main(void) {
    struct date today;
    readDate( & today);
    printDate(today);
    return 0;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900