In this exercise, your program will read a first name and last name (separated by a space) from a file (name.txt), each string is up to 10 characters. Store them in two c-strings, i.e., two character arrays, e.g., firstName, lastName, with enough space to store them. What is the minimum size of each array (but still enough to store the names) ? Use that number to declare the arrays (otherwise, your program will waste memory space). After reading the first name and last name, then your program will call a function, e.g., generate FullName, which will combine the first name and last name and save it to the third array. The full name should appear in the format of last name, first name, where the last name comes first, then a comma and a space and then the first name. Think about how large the array of the full name needs to be; and do not forget to count the extra comma and space. The function will take four arguments: the array that stores the first name, array that stores the last name, array that stores the full name, and the size of the array that stores the full name. Why do we need the size of the array here? The program will output the full name to a file called “fullname.txt” after calling the function. You may not use %s with scanf or gets, which are not safe as we mentioned in the class. Must use %c with fscanf to read two strings.
Get Free Quote!
272 Experts Online