Skip to content
Home » C Programs » Palindrome Program in C Using String Functions

Palindrome Program in C Using String Functions

Basic program to check palindrome string in c. In this program, we can check the string is palindrome or not using string functions in a c programming language.

Header File String.h in C

The header string.h defines one variable type, one macro, and a number of functions for manipulating character arrays. A string is defined as a collection of characters. A character array differs from a string in that the string is terminated with the special character ‘0’. String declarations: A string can be declared in the same way that a one-dimensional array can. 

If Else Statement in C

In C, the if-else statement is used to carry out operations based on a set of conditions. If and only if the given condition is true, the operations specified in the if block are executed. 

If the if (true/false expression) is false, the if/else statement adds an action to the if statement. The program will always execute something with an if/else statement because it will either execute the true code block or the false code block.

Program to Check Palindrome String in C

//Program to Check Palindrome String in C
#include<stdio.h> 
#include<string.h>
int main()
{
char s[500]; 
int i,n,c=0;
printf("Enter The String ");
gets(s);
n=strlen(s);
for(i=0;i<n/2;i++) 
{
if(s[i]==s[n-i-1])
c++;
}
if(c==i)
printf("String is Palindrome");
else
printf("String is Not Palindrome");
return 0;
}

Output of Program to Check Palindrome String in C:

Enter The String maam
String is Palindrome

Hello World Program in C Using Function 

C Program to Add Two Numbers Using Functions 

C Program to Add Two Numbers Using Pointers 

Odd or Even Program in C Using Array 

Odd or Even Program in C Using For Loop 

Odd or Even Program in C Using Function 

C Program to Add Two Numbers Without Using Addition Operator 

C Program to Add Two Numbers Without Using Third Variable 

Odd or Even Program in C Using Conditional Operator 

C Program to Check Vowel or Consonant Using Switch Case 

Binary releases – Code::Blocks

GDB online Debugger | Compiler – Code, Compile, Run, Debug online C, C++

Online Compiler and Editor/IDE for Java, C/C++, PHP, Python, Perl, etc

C (programming language)

Applications of C Programming That Will Make You Fall In Love With C