Professional Documents
Culture Documents
Lab Report On: A Program That Will A String As Input and Print The Position of The Substring in The Output
Lab Report On: A Program That Will A String As Input and Print The Position of The Substring in The Output
On
A program that will a string as input and print the position
of the substring in the output
COURSE CODE: CSE 232
Course Title: Data Structures Lab
Experiment No - 01
#include <stdio.h>
int main()
int i, j, temp = 0;
gets(str);
gets(sub_str);
j = 0;
if(str[i] == sub_str[j])
temp = i+1;
while(str[i] == sub_str[j])
i++;
j++;
if(sub_str[j] == '\0')
else
i = temp-1;
temp = 0;
if(temp == 0)
return 0;