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
How can I do serial ("comm") port I/O?
Is calloc better than malloc?
Can a local variable be volatile in c?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
Explain null pointer.
What is the scope of static variable in c?
Explain what are the different data types in c?
What are register variables in c?
Differentiate between a structure and a union.
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
What are the string functions? List some string functions available in c.
What are keywords in c with examples?
Is c is a low level language?
Explain about the constants which help in debugging?