Q:

How to update char monthName[256];

My assignment is to create a calendar when the user enters a month and year. All of that is working great, but I can't figure out how to update a char monthName[256]; variable. My guess is monthName = "January" (or whichever month), but that doesn't work. Not sure what I'm doing wrong.
FWIW, the user doesn't enter the month name. I have to print it to the screen based on the month number the user enters.

A:

You should use std::string instead, such as std::string monthName = "Jan"; monthName = "Feb";.
If there is some reason you must use C-style strings, then std::strcpy will solve your problem. Such as std::strcpy(monthName,"Jan");, which will copy the string "Jan" into the character array. You cannot assign a character string directly to an array like that. 

