I am learning a C program. When I try to run the code, I get an error: [Error] ld returned 1 exit status
#include <stdio.h>
#include <time.h>
void main()
{
time_t t;
time(&t);
clrscr();
printf("Today date and time : %s",ctime(&t));
getch();
}
Can someone explain to me what I'm doing wrong here?
I tried this code:
int main()
{
printf("Today date and time : %s \n", gettime());
return 0;
}
char ** gettime() {
char * result;
time_t current_time;
current_time = time(NULL);
result = ctime(¤t_time);
return &result;
}
but still showing me an error like: error: called object '1 is not a function in current_time = time (NULL); line. What's wrong with the code
user3407267
source
share