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

The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

634


What is define directive?

640


What is meant by errors and debugging?

648


Where static variables are stored in c?

587


What is the difference between malloc calloc and realloc in c?

649






the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....

22228


what are the facialities provided by you after the selection of the student.

1658


Differentiate between declaring a variable and defining a variable?

607


What is bubble sort technique in c?

592


How is a null pointer different from a dangling pointer?

557


What are header files and explain what are its uses in c programming?

612


Can you define which header file to include at compile time?

589


What is the g value paradox?

645


What are qualifiers and modifiers c?

549


What is a ternary operator in c?

652