A string p is a prefix of a string s if the leading characters of s are identical to p. For example, "abc" is a prefix of "abcde". Develop a function prefix that checks if a C string p is a prefix of another C string s.
p
s
"abc"
"abcde"
prefix
p是s的前綴若s開頭的一段字串等於p。例如,"abc"是"abcde"的前綴。寫一個程式 判斷字串p是否字串s的前綴。
Example input 1:
abc abcde
Example output 1:
abc is a prefix of abcde
Example input 2:
bc abcde
Example output 2:
bc is not a prefix of abcde
Hidden content!#include<stdio.h>#include<string.h>char prefix(char string1[],char string2[]){ int i,s;* * * * ** ** *** ** * *