program to locate string with in a string with using strstr
function
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / gmail
#include<iostream.h>
#include<conio.h>
void main()
{
char str1[15],str2[15];
clrsacr();
cout<<"Enter a string";
cin>>str1;
cout<<"\nEnter another string to be located";
cin>>str2;
int n;
n=strstr(str1,str2);
if(n==0)
cout<<"\nstring not locatd";
else
cout<<"At location "<<(n+1);
getch();
}
| Is This Answer Correct ? | 3 Yes | 6 No |
Write a program of prime number using recursion.
struct tag{ auto int x; static int y; };main() { struct tag s; s.x=4; s.y=5; printf(ā%dā,s.x); }
the maximum width of a c variable name can be a) 6 characters b) 8 characters c) 10 characters d) 20 characters
What are the two types of functions in c?
How do you construct an increment statement or decrement statement in C?
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
What are valid signatures for the Main function?
What is difference between stdio h and conio h?
count the numbers between 100 and 300, that star with 2 and ends with 2
What is meant by keywords in c?
How can I get back to the interactive keyboard if stdin is redirected?
What does char * * argv mean in c?