write a program of palindrome(madam=madam) using pointer?
Answer Posted / priyanka
#include<stdio.h>
#include<conio.h>
int stpal(char str[50]);
void main()
{
char str[50];
int pal;
clrscr();
printf(“nnt ENTER A STRING…: “);
gets(str);
pal = stpal(str);
if(pal)
printf(“nt THE ENTERED STRING IS A PALINDROME”);
else
printf(“nt THE ENTERED STRING IS NOT A PALINDROME”);
getch();
}
int stpal(char str[50])
{
int i = 0, len = 0, pal = 1;
while(str[len]!=’′)
len++;
len–;
for(i=0; i<len/2; i++)
{
if(str[i] == str[len-i])
pal = 1;
else
{
pal = 0;
break;
}
}
return pal;
}
Is This Answer Correct ? | 2 Yes | 11 No |
Post New Answer View All Answers
How do I read the arrow keys? What about function keys?
Write a program to check whether a number is prime or not using c?
Explain how many levels deep can include files be nested?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
What are enums in c?
What is console in c language?
Why do we use null pointer?
Explain setjmp()?
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.
What is type qualifiers?
Explain continue keyword in c
What is f'n in math?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
Can we compile a program without main() function?
a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode