- 1 Write The Following Function Note In This Part You Can Use C Style String Library Functions A Write A Function That 1 (125.3 KiB) Viewed 44 times
1) Write the following function Note: In this part you can use C-style string library functions a) Write a function that
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
1) Write the following function Note: In this part you can use C-style string library functions a) Write a function that
1) Write the following function Note: In this part you can use C-style string library functions a) Write a function that takes an array of strings and its size and returns the length of the largest element in the list. b) Write a function that takes an array of strings and returns a concatenation string of all its elements separated by a white space. c) Write a function strsort that takes an array of strings and its size and then it sorts the array alphabetically. Find and use the implementation of selection sort algorithm (you can find it online or in any text book). d) Write a main function and test these functions using the following array of strings: char *fruites[5] = {"apple", "banana", "orange", "apricot", "pineapple"}; 2) Implement a pointer version of the C-style string library function strcmp. Remember, strcmp takes two strings r and s as input and returns an integer value greater than, equal to or less than zero if the C-style string r is less than, equal to, or greater than the C-style string s. Use the constant quilifier for the function parameters that should be constant. 3) Implement a pointer version of the C-style strcpy library function which makes a copy of its second argument to its first argument and returns a pointer to new copy. Again use the const qualifier where you can. 4) implement your pointer based version of the C-style strlen library function which takes a string as input parameter and returns its length.