write a function to find whether a string is palindrome or
not and how many palindrome this string contain?
Answer Posted / nadeem
bool palindrome(char *str){
char *ptr1 = str;
char *ptr2 = str + strlen(str) - 1;
while(ptr1 < ptr2){
if(*ptr1++!= *ptr2--)
return false;// not palindrome
}
return true;//palindrome
}
| Is This Answer Correct ? | 3 Yes | 6 No |
Post New Answer View All Answers
What are the advantages of Macro over function?
Do you have any idea about the use of "auto" keyword?
Explain what are the different data types in c?
Why do we use pointer to pointer in c?
What are two dimensional arrays alternatively called as?
Write a program to maintain student’s record. Record should
not be available to any unauthorized user. There are three
(3) categories of users. Each user has its own type. It
depends upon user’s type that which kind of operations user
can perform. Their types and options are mentioned below:
1. Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record)
2. Super Admin
(Search Record [by Reg. No or Name], View All Records,
Insert New Record, Modify Existing Record, Delete Single Record)
3. Guest
(Search Record [by Reg. No or Name], View All Records)
When first time program runs, it asks to create accounts.
Each user type has only 1 account (which means that there
can be maximum 3 accounts). In account creation, following
options are required:
Login Name: <6-10 alphabets long, should be unique>
Password: <6-10 alphabets long, should not display
characters when user type>
Confirm Password:
Is fortran faster than c?
How does normalization of huge pointer works?
How can you increase the allowable number of simultaneously open files?
If I have a char * variable pointing to the name of a function ..
What is dynamic dispatch in c++?
What is c method?
Is anything faster than c?
What is identifiers in c with examples?
What are the valid places to have keyword “break”?