compare two character

Hello All,
I want to compare two character and then print some text but I can not.
Thanks in advance,
Bayat

1
2
3
4
5
6
7
8
9
10
11
12
#define ringNo ( 3 )
#define struNo ( 1 )
int main()
{
string rsArraysize[9];

sprintf(rsArraysize,"r%ds%dsize",ringNo,struNo);

if (rsArraysize == "r3s1size")  
fprintf(stdout,"\n%s\n","OK");
return 0;
}
Line 5, string rsArraysize[9]; uses an array of C++ strings. All the rest of the code is C.

If that line is changed to char instead of string it would make more sense.

At line 9, to compare two c-strings, use the strcmp() function.
http://www.cplusplus.com/reference/cstring/strcmp/
Topic archived. No new replies allowed.