ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Write a C program that reads a series of strings and prints 
only those ending in "ed"
 Question Submitted By :: Saphira
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Write a C program that reads a series of strings and prints only those ending in "ed"
Answer
# 1
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 ?    2 Yes 4 No
Antony From Chennai
 
  Re: Write a C program that reads a series of strings and prints only those ending in "ed"
Answer
# 2
#include<stdio.h>

main()
{
    
    char *a[6]={"sayed","jhsdj","manvi","buged","error"};
       
    int i,j,k,h;
    int flag=0;
    
    for(i=0;i<5;i++)
    {
        j=0;
        j=strlen(a[i]);
        if(*(a[i]+3)=='e'&& *(a[i]+4)=='d')
        {
            printf("%s\n",a[i]);
        }
        else
        {
            printf("no match\n");
        }
    }
}
 
Is This Answer Correct ?    2 Yes 0 No
Mani
 
 
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
what r callback function?  1
how the size of an integer is decided? - is it based on processor or compiler or OS? nvidia16
a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static Which of the Following Statements are true w.r.t Bit-Fields A)a,b&c B)Only a & b C)Only c D)All Accenture2
What's a "sequence point"?  2
the code is::::: if(condition) printf("hello"); else printf("world"); WHAT WILL BE THE CONDITION IN IF IN SUCH A WAY THAT BOTH HELLO AND WORLD ARE PRINTED IN A SINGLE ATTEMPT?????? SINGLE ATTEMPT IN THE SENSE... IT MUST FIRST PRINT "HELLO" AND IT MUST GO TO ELSE PART AND PRINT "WORLD"..... NO LOOPS, RECURSION ARE ALLOWED........................ IBM9
what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; } Honeywell2
Find the middle node in the linked list?? (Note:Do not use for loop, count and count/2) Subex2
Dear Sir, we are required the bubble sorting programs Regs Prem  1
What is the difference between constant pointer and pointer to a constant. Give examples. TCS3
Why doesn't C have nested functions?  2
write a “Hello World” program in “c” without using a semicolon?  3
how many keywords do C compile? Microsoft2
Difference between null pointer and dangling pointer? Wipro3
which of the function operator cannot be over loaded a) <= b)?: c)== d)* HCL7
void main() {int a[5],i,b=16; for(i=0;i<5;i++) a[i]=2*i; f(a,5,b); for(i=0;i<5;i++) printf("\n %d",a[i]); printf("\n %d",b); } f(int *x,int n,int y) { int i; for(i=0;i<n;i++) *(x+i)+=2; y=y+2; }wat r the errors in the prg.and improvise the prg to get o/p.?  2
differentiate between const char *a; char *const a; and char const *a; HCL1
i want to have a program to read a string and print the frequency of each character and it should work in turbo c  2
Write a C program to print 1 2 3 ... 100 without using loops?  5
How can I implement opaque (abstract) data types in C? What's the difference between these two declarations? struct x1 { ... }; typedef struct { ... } x2;  2
WHY DO WE USE A TERMINATOR IN C LANGUAGE?  2
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com