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
What are global variables?
How do you use a 'Local Block'?
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.
Why pointers are used in c?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor
What is the difference between c &c++?
What is a pragma?
How would you obtain the current time and difference between two times?
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
why return type of main is not necessary in linux
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
Why do we write return 0 in c?