/* mktime example: weekday calculator */
/* fixed by P C */
#include <stdio.h>
#include <time.h>
int main(){
time_t rawtime;
struct tm *timeinfo;
int year, month ,day;
char buffer[64]="";
/* prompt user for date */
printf("\\nEnter year (number): "); scanf("%d",&year);
printf("\\nEnter month (number): "); scanf("%d",&month);
printf("\\nEnter day (number): "); scanf("%d",&day);
/* get current timeinfo and modify it to the user's choice */
time(&rawtime);
timeinfo = localtime(&rawtime);
timeinfo->tm_year = year - 1900;
timeinfo->tm_mon = month - 1;
timeinfo->tm_mday = day;
/* call mktime: timeinfo->tm_wday will be set */
mktime(timeinfo);
/* display the weekday (this is a fix for the deprecated conversion to char*) */
strftime(buffer,64,"That day is a %A",timeinfo);
I believe the OP attempted to correct the sample code shown on the reference page of this website: http://cplusplus.com/reference/clibrary/ctime/mktime/ which appears to have been written as a C89 program, and, among other issues, attempts to initialize char* pointers using string literals.