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
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b
Is array name a pointer?
What do you mean by a local block?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
Is c is a procedural language?
What is structure pointer in c?
Write a program to print fibonacci series using recursion?
What are the advantages and disadvantages of a heap?
When do you not use the keyword 'return' when defining a function a) Always b) Never c) When the function returns void d) dfd
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
How can you increase the size of a statically allocated array?
What are 'near' and 'far' pointers?
Which built-in library function can be used to match a patter from the string?
In a switch statement, explain what will happen if a break statement is omitted?