C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

Write a C program to print the given string from the first occurrence of a given character?

0 votes
1,439 views
asked Jan 7, 2014 by sara Guru (24,570 points)

1 Answer

0 votes

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

{

char *ptr; char text1[20], text2[2];

clrscr();

printf(“Enter string:”);

gets(text1);

printf(“Enter character:”);

gets(text2);

ptr=strpbrk (text1, text2);

puts(“string from given character”);

printf(ptr);

getch();

}

Output:

Enter a string: INDIA IS GREAT

Enter character :G

String from given character: GREAT 

answered Jan 7, 2014 by rajesh Guru (39,140 points)

Related questions

0 votes
1 answer 200 views
0 votes
1 answer 3,089 views
0 votes
1 answer 439 views
0 votes
1 answer 2,580 views
...