Please help me understand what is going on here. The two printfs give two differnt outputs, why. My goal is to pass the asciitime return to a string the main function can use.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
//Funtion Declarations
void getCurDateTime(char* DT);
//Functions
int main()
{
//Private variables
char CurDT[80];
getCurDateTime(CurDT);
printf("%s\n",CurDT); // diff. output than function
system("PAUSE");
return 0;
}
void getCurDateTime(char* DT)
{
time_t now;
struct tm *ptr;
now = time(0);
ptr = localtime(&now);
DT = asctime(ptr);
printf("%s\n",DT); //output that i want in main
}