Write a C program that reads a series of strings and prints
only those ending in "ed"
Answer Posted / antony from chennai
void main()
{
char *s[10];
int n;
printf("No of strings:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%s",s[i]);
}
for(i=1;i<=n;i++)
{
int len;
len=strlen(*s[i]);
len=len-1;
if(*s[len]='e' && *s[len--]='d')
{
printf("%s",*s[i]);
}
else
{
printf("no match");
}
}
getch();
}
}
Is This Answer Correct ? | 4 Yes | 16 No |
Post New Answer View All Answers
Why is it usually a bad idea to use gets()? Suggest a workaround.
Why static variable is used in c?
Once I have used freopen, how can I get the original stdout (or stdin) back?
What is dynamic dispatch in c++?
How do you redirect a standard stream?
What is a memory leak? How to avoid it?
What is the significance of an algorithm to C programming?
What is the difference between formatted&unformatted i/o functions?
can anyone please tell about the nested interrupts?
In C, What is the #line used for?
How many parameters should a function have?
what is the difference between class and unio?
Why c is called free form language?
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 double pointer?