Write a C program that reads a series of strings and prints
only those ending in "ed"

Answer Posted / mani

#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 ?    11 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is main an identifier in c?

591


where are auto variables stored? What are the characteristics of an auto variable?

577


Write a program of prime number using recursion.

607


Why is event driven programming or procedural programming, better within specific scenario?

1942


Why c is called object oriented language?

573






What is the return type of sizeof?

579


Define recursion in c.

691


What are the ways to a null pointer can use in c programming language?

581


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

754


Why does this code crash?

607


Tell me what is null pointer in c?

601


How can a process change an environment variable in its caller?

645


What are structure types in C?

653


How can I implement sets or arrays of bits?

595


Write a factorial program using C.

633