This is the code but I am getting errors, too few arguments in realtime and expected expression before char.
I am trying to write a method then pass information(input) through the method and get a value(output)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
char realtime(char input[20], char output[25]){
//char input[20];
//char output [25];
char year[5];
char month[3];
char day[3];
char hour[3];
char min[3];
char sec[3];
strncpy(year, input, 4);
year[4] = '\0';
strncpy(month, input + 4, 2);
month[2] = '\0';
strncpy(day, input + 6, 2);
day[2] = '\0';
strncpy(hour, input + 8, 2);
hour[2] = '\0';
strncpy(min, input + 10, 2);
min[2] = '\0';
strncpy(sec, input + 12, 2);
sec[2] = '\0';
sprintf(output, "%s-%s-%sT%s:%s:%s", year, month, day, hour, min, sec);
return 0;
}
int main(){
char input = "20181204193456";
realtime( char input[20], char output[25]);
printf("Parsed Date %s", output);
}