Storm33229
Knight
C++ Problem
I enter string and it returns false and crashes...any ideas? I believe that I'm using an incorrect method to compare a literal(?) string to a collection of characters. But I'm unsure of any other way to do this. Help appreciated.
Code:
#include <iostream>
using namespace std;
int main()
{
char string[6];
cout << "enter string: ";
gets(string);
if(string == "string")
cout << "true";
else
cout << "false";
return 0;
}