0

String pelindrome or not. There is no syntax error but y it is showing wrong output Output it is showing: Noob Is pel

String pelindrome or not. There is no syntax error but y it is showing wrong output
Output it is showing:
Noob
Is pel

#include<iostream>
#include<string.h>
int main()
{
  char i[]="noop";
  court<<i<<endl;
  (i==strrev(i))?cout<<" pel": cout<<" not pel";
  cout<<endl;
  return 0;
}
Markus Meyer
  • 3,327
  • 10
  • 22
  • 35
  • 1
    Please add your code as text in the question, not an image. – Retired Ninja Aug 17 '22 at 04:11
  • 1
    Does this answer your question? [How do I properly compare strings in C?](https://stackoverflow.com/questions/8004237/how-do-i-properly-compare-strings-in-c) – Retired Ninja Aug 17 '22 at 04:13
  • 1
    @RetiredNinja `strcmp` won't help here, as `strrev` reverses in place. The two pointers are always equal, and so of course are the contents they point to. – Igor Tandetnik Aug 20 '22 at 22:58

0 Answers0