How to check whether string is a palindrome, WITHOUT USING
STRING FUNCTIONS?
Answer Posted / narasimharao
#include<stdio.h>
#include<conio.h>
void main()
{
char str[20]="malayalam",str1[20];
int i,j,k,c;
clrscr();
for(c=0;str[c]!='\0';c++)
{
}
printf("%d\n",c);
for(i=c-1,j=0;i>=0;i--,j++)
{
str1[j]=str[i];
}
printf("%s\n",str1);
k=1;
for(i=0;str[i]!='\0';i++)
{
if(str[i]!=str1[i])
{
k=0;
break;
}
}
if(k==1)
printf("Given String is Palindrome");
else
printf("Given String is Not Palindrome");
getch();
}
| Is This Answer Correct ? | 10 Yes | 8 No |
Post New Answer View All Answers
How are portions of a program disabled in demo versions?
How can I sort a linked list?
Who is the main contributor in designing the c language after dennis ritchie?
What is memcpy() function?
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer
Why we use void main in c?
What is string concatenation in c?
Why do we write return 0 in c?
Using which language Test cases are added in .ptu file of RTRT unit testing???
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
How can type-insensitive macros be created?
What are structural members?
Is c is a high level language?
What is meant by recursion?