String Manipulation 2
String Manipulation 2
String manipulation refers to the process of performing operations on strings, such as copying,
concatenating, comparing, finding length, reversing, or replacing characters.
---
A palindrome is a string that reads the same forward and backward (e.g., "madam", "level").
Code Example
#include <stdio.h>
#include <string.h>
int main() {
char str[100], reversed[100];
int length, isPalindrome = 1;
// Input string
printf("Enter a string: ");
scanf("%s", str);
// Find length of the string
length = strlen(str);
// Output result
if (isPalindrome) {
printf("The string '%s' is a palindrome.\n", str);
} else {
printf("The string '%s' is not a palindrome.\n", str);
}
return 0;
}
Input:
Output:
Input: