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
Difference between MAC vs. IP Addressing
Write a function that will take in a phone number and output all possible alphabetical combinations
What is #include stdio h and #include conio h?
What is formal argument?
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
Which function in C can be used to append a string to another string?
How would you obtain the current time and difference between two times?
Explain what is the most efficient way to store flag values?
What are the scope of static variables?
Why do we use return in c?
What is meant by gets in c?
Why does the call char scanf work?
What is header file definition?
What is the difference between a string and an array?
Explain how does free() know explain how much memory to release?