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 used in scanf in c?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
if p is a string contained in a string?
Can the sizeof operator be used to tell the size of an array passed to a function?
What are different types of pointers?
What do you mean by Recursion Function?
Explain what is the difference between text files and binary files?
What is break statement?
How can I call fortran?
explain what is a newline escape sequence?
Is the exit() function same as the return statement? Explain.
Why is c faster?
cavium networks written test pattern ..
When would you use a pointer to a function?
What are the benefits of organizational structure?