palindrome program isn't working using character array
#include <iostream> using namespace std; #include <conio.h> main() { int n; cout << "Enter the Size of character array" << endl; cin >> n; char name[n]; cout << "Enter your name" << endl; cin >> name; int count = 0, i = 0; while (name[i] != '\0') { count++; i++; } cout << "Your name is of " << count << " characters" << endl; int j = 0, k = count; bool flag = true; while ( j <= k) { if (name[j] != name[k]) { flag = false; break; } else if (name[j] == name[k]) { j++; k--; } } if (flag == true) { cout << "True"; } else { cout << "False"; } }