to write a program to search a character in a string and to
print till the character in the string using pointers in c
program

Answer Posted / guest

char str[20]="some string";
char *ptr=str;
char search_char=e;
for(int t=0;i<strlen(str);i++)
{
if((*ptr)==e) (*ptr)=\0' //null charachter
}
printf("%s",str);

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the difference between composite key and primary key in sap abap

2122


2. Tell me about a time when you had to use your presentation skills to influence someone's opinion.

1560


c# code, vb.net code language parity refers to what?

3068


sir ,,kindly provide me 10 year old solved question papers of gate ,i am from CS. branch...

1615


sir i m reject two time in u.s in spring intake now im taking a date of 1july-2010 in fall intake &im competed my bachlor degree(chem) in jun-2009 so what answer i give to visa officer ask me a what r u doing last 1-year bcoz i have no work expirience

1352






hi all I got two exam call letter one from maha ganeco & other from federal bank both at same time & same date which should i choose (note I am eng. grad.)

1685


what we have to say about hobbies,strong points,weak points

1781


i want a program in c# for 100 or for a number greater than 100.....pls help

1462


HELLO ALL OF U.I HAVE QUALIFIED IN SBI CLERICAL WRITTEN EXAMINATION AND MY INTERVIEW IS ON 20TH OF THIS MONTH.IAM SOTWARE BACKGROUNDED CANIDIATE SO CAN ANY ANYBODY WHOSE INTERVIEW IS OVER CAN TELL ME THAT WHAT QUESTIONS THEY ASKED RELATING TO COMPUTER SCIENCE.

1395


Please derive the formula for the area of a circle.

626


how bluetooth works?what is principle behind in it?

5690


write a programe to print this string in reverse order and find out how many times letter c is repeated? string = { c was desined by dennis ritchie}. also find out the lenth of the string.

1451


What is the difference between CD-R and CD+R?

1793


Index of an Array containing 'n' aliment varies from________to_______

1577


How to freely move a ball in graphics mode.

1902