I understand it’s a stupid question but I just don’t understand the answer.
The Code:
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "What's Your Name?" << endl;
string hay;
hay = "hi";
string name;
cin >> name;
printf("hay%s, name%s
",hay,name);
return 0;
}
Here’s the full error:
Unhandled exception at 0x5DFFFB53 (msvcr120d.dll) in MrFirstApp.exe: 0xC0000005: Access violation reading location 0xCC006968.
I think it has something to do with the printf/the %s in the code.
If you answer, please explain this to me, I just started C++ and I’m awful. Also could someone explain why there’s a
?
Thanks!