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

How can I find out how much free space is available on disk?

622


Why is #define used?

788


What is malloc calloc and realloc in c?

660


Explain what is the most efficient way to store flag values?

692


Do you know the purpose of 'register' keyword?

640






What is c basic?

591


Why do we use c for the speed of light?

603


How does pointer work in c?

613


What are variables and it what way is it different from constants?

782


What is wrong with this statement? Myname = 'robin';

812


How can I call a function with an argument list built up at run time?

631


How can I determine whether a machines byte order is big-endian or little-endian?

615


What is the full form of getch?

580


What are directives in c?

539


What is c system32 taskhostw exe?

582