vendredi 12 février 2021

FACING PROBLEM WHILE COMPARING "Hello" with "olleH"

I am trying to make a program in c where it can identify if a string is equal to its reverse or not.

#include <stdio.h>
#include <string.h>
#include <conio.h>
int main(){
    char str1[10] = "Hello";
    if (str1 == strrev(str1)){
        printf("True");
    }
    else{
        printf("False");
    }
getch();
return 0;
}

According to my knowledge, it should print False but it is printing True instead. Can anyone fix this issue. Thanks

Aucun commentaire:

Enregistrer un commentaire