Post date: Mar 25, 2011 6:39:46 AM
Reading and Hands-on: Read the text book topics in 5.2 and 5.3 to know about specification and Implementation of scalar and composite data types. Also solve the problems given in the section 5.6 of the text book.
Implement the following string library functions using make file
char *strcpy( char *s1, const char *s2)
copies the string s2 into the character array s1. The value of s1 is returned.
char *strcat( char *s1, const char *s2)
appends the string s2 to the end of character array s1. The first character from s2 overwrites the '\0' of s1. The value of s1 is returned.
char *strchr( const char *s, int c)
returns a pointer to the first instance of c in s. Returns a NULL pointer if c is not encountered in the string.
int strcmp( const char *s1, const char *s2)
compares the string s1 to the string s2. The function returns 0 if they are the same, a number < 0 if s1 < s2, a number > 0 if s1 > s2.
size_t strspn( char *s1, const char *s2)
returns the length of the longest substring of s1 that begins at the start of s1and consists only of the characters found in s2.
size_t strlen( const char *s)
determines the length of the string s. Returns the number of characters in the string before the '\0'.
char *strstr( const char *s1, const char *s2)
returns a pointer to the first instance of string s2 in s1. Returns a NULL pointer if s2 is not encountered in s1.