0

Well, I am learning the C program. When I wrote a command I got an error message but I don't know why. The code runs like this:-

if (answer == "something")

[here, the 'answer' is a string variable]

1
1

You cannot compare strings in C to compare strings you must use a function called strcmp()if I remember correctly it should be in the string.h so just #include <string.h> and you should be able to use it.

If both strings are identical it should return 0, if not then the strings are not equal.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .