program to locate string with in a string with using strstr
function

Answer Posted / pradeep

#include<stdio.h>
#include<string.h>
void main()
{
char *str1,*str2,*ptr;
printf("Enter string1:");
scanf("%s",&str1);
printf("Enter string2:");
scanf("%s",&str2);
ptr=strstr(str1,str2);
if(ptr==0)
printf("String not located");
else
printf("string located are %s",ptr);
}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is c called c?

635


Is javascript written in c?

586


What is the scope of an external variable in c?

571


Write the test cases for checking a variable having value in range -10.0 to +10.0?

1821


write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.

4992






What are bitwise shift operators in c programming?

650


Differentiate fundamental data types and derived data types in C.

621


Tell me the use of bit field in c language?

631


What is malloc calloc and realloc in c?

673


What are examples of structures?

600


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3504


What's the total generic pointer type?

618


What is the use of #include in c?

583


What is the difference between null pointer and wild pointer?

642


There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?

827