I keep getting this odd problem where these characters appear in my char array called day[3]. My goal is to use the computers clock and get the date and time. I put that into a string called dayHolder and want to just add the day it to a char array called day. But when I do this it gets a lot of odd characters. I understand that the string should end with '\0' but cant seem to get day to just display "Fri"....
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <time.h> #include <string> using namespace std; int main() { // Functions functions myFunc; //Variables + installations string dayHolder; char day[3]; char whitespace = ' '; time_t current = time(0); dayHolder = ctime(¤t); for (int i = 0; i < 3; i++) { day[i] = dayHolder[i]; } cout << ctime(¤t) << endl; cout << dayHolder << endl; cout << day << endl; return 0; } 
So what can I do to fix this problem? I am sure its something simple that I am overlooking so any advise or suggestions would be appreciated thanks.
char day[4] ... day[3] = '\0';?