What to do

user01 Reply 9 years 26 weeks ago
Could you explain what I am supposed to do for this question please?
pichulia Reply 9 years 26 weeks ago
Let there is a string 'S'. Now, we want to change this string by some commands. There are 3 type of command; strncpy, strncat, strncmp. strncpy : if the integer 'n' and string 'str' is inputed, change first 'n' strings of 'S' to first 'n' strings of 'str'. for example, if 'S' is "ABCDE", 'str' is "abcde", n is 3, S become "abcDE" strncat : if the integer 'n' and string 'str' is inputed, concat the first 'n' strings of 'str'. after string 'S' for example, if 'S' is "ABCDE", 'str' is "abcde", n is 3, S become "ABCDEabc" strncmp : compare the first 'n' string between 'S' and 'str' if 'S' is smaller than 'str' (ASCII-order), print -1; else if 'S' is bigger than 'str', print 1; if two are same, print 0 for example, 'S' is "ABCDE" and 'str' is "abcdefg" and n is 3, result is -1, if 'str' is "ABCAAAAA" and n is 3. result is 0 if n is 4, result is 1.
pichulia Reply 9 years 26 weeks ago
This problem say, print the result for each strncmp command