I was trying to compile the code given in a document, which is not compiling,
Here is the code:-
#include<stdio.h> #include<time.h> typedef struct { int day; int month; int year; }Date; //struct date Dob; void printDate(Date d) { printf("%d/%d/%d\n",d.day,d.month,d.year); }
int main() { Date d; void printDate(Date d); d.day=8; d.month=1; d.year=2023; return 0; } this is the error Iam getting:-
printDate.c:24:1: warning: data definition has no type or storage class 24 | printDate(Date d); | ^~~~~~~~~ printDate.c:24:1: warning: type defaults to ‘int’ in declaration of ‘printDate’ [-Wimplicit-int] printDate.c:24:1: error: conflicting types for ‘printDate’; have ‘int(Date)’ printDate.c:10:6: note: previous definition of ‘printDate’ with type ‘void(Date)’ 10 | void printDate(Date d) | ^~~~~~~~~