I have this code here:
#include <stdio.h>
int isSubstring (char s[], char t[])
{
int i, j, k, pos;
pos = -1;
for (i = 0; s[i] != '\0'; i++)
{
for (j = i, k = 0; t[k] != '\0' && s[j] == t[k]; j++, k++)
;
if (k > 0 && t[k] == '\0')
pos = i;
}
return pos;
}
int main()
{
char s[] = "All work and no play makes Jack a dull boy.";
char t[5];
char name;
printf("Name to substitute: ");
scanf("%s",&t);
/*Here - This bit not sure what to put*/
name = isSubstring (s, "Jack" , t);
printf("%s %s",name );
/*To here*/
system("pause");
}
I wnat to substitutes the text Jack in the string variable quote with the content of the variable name.
like this;
Name to substitute: Mark All work and no play makes Mark a dull boy
I don't what to put there so can i get help
thank you

New Topic/Question
Reply



MultiQuote




|