Question: IMPORTANT NOTE = MUST USE *char INSTEAD OF STRINGS. STRINGS MUST NOT BE USED . Q1: String Manipulation Write the implementation of the following functions:

 IMPORTANT NOTE = MUST USE *char INSTEAD OF STRINGS. STRINGS MUST

NOT BE USED . Q1: String Manipulation Write the implementation of the

IMPORTANT NOTE = MUST USE *char INSTEAD OF STRINGS. STRINGS MUST NOT BE USED .

Q1: String Manipulation Write the implementation of the following functions: int Strlen (char *s1) 2 /* Returns the length of the string in number of characters. */ 3 { 4 } char *Strcpy ( char *sl, /* Copies string s2 into array sl. The value of sl is returned. */ 3 { } const char *s2 ) 4 char *Strncpy ( char *sl, const char *s2, int n ) /* Copies at most n characters of string s2 into array sl The value of sl is returned. */ 3 5 } char *StrCat ( char *s1, const char *s2 ) 2 /* Appends string s2 to array sl. The first character of s2 overwrites the terminating n ull character of sl. The value of sl is returned. */ { } 1 3 4 char *StrnCat ( char *sl, const char *s2, int n) 2 /* Appends at most The first character of s2 overwrites the terminating n ull character of sl. The value of sl is returned. */ 5 { 6 } n characters of string s2 to array sl. 3 4 char *StrnCat ( char *s1, const char *s2, int n) 2 /* Appends at most n characters of string s2 to array sl. 3 The first character of s2 overwrites the terminating null character of sl. 4 The value of sl is returned. */ 5 { 6 } int StrCmp( const char *sl, const char *s2 ) 2 /* Compares the string sl with the string s2. 3 The function returns 0, less than 0 or greater than 0 if sl is equal to, less than or greater than s2, respectively.*/ 5 { 6 } 4 int StrnCmp( const char *sl, const char *s2, int n ) 2 /* Compares up to n ch aracters of the string s with the string s2. 3 The function returns 0, less than 0 or greater than 0 if sl is equal to, less than or greater than s2, respectively.*/ 5 { 6 } 4 char ** StrTok ( char *sl, const char s2) 2 /*A call to StrTok breaks string sl into '' tokens '' 3 (logical pieces such as words in a line of text) separated by character 4 contained in char s 2 * / 5 { 6 } int StrFind (char *sl, char *s2) 2 /* Searches the string sl for the first occurrence of the string s2 3 and returns its starting index, if s2 not found returns -1. */ 4 { 5 } char * SubStr (char *, int pos, int len) 2 /* This function returns a newly constructed string with its value initialized to a copy of a substring of this variable. 4 The substring is the portion of the string that starts at character position ''pos '' and spans '' len '' characters 6 (or until the end of the string, whichever comes first). */ 7 { 8 } 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!