So I have the following code:
void Start(int &year, string &mon, char &nyd)
{
printf("%s", mon);
int month= atoi(mon.c_str());
printf("%i", month);
}
When the incoming parameter is "03" (the first printf shows 03), I got 0 for month.
However, if I add this line
mon = "03";
I got 3, which is correct, for month.
Why......????
EDIT: I figured it out. You guys were right. DON'T use scanf for string input.