ProAnswers.org

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

#include

#include 

#include 

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