Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the following function: void get_extension(const char *file_name, char*ext

ID: 3614549 • Letter: W

Question

Write the following function: void get_extension(const char *file_name, char*extension); file_name points to a string containing a file name. Thefunction should store the extension on the file name in the stringpointed to by extension. For example, if the file name is"memo.txt",the function will store "txt" in the string pointedto by extension. If the file name doesn't have an extension, thefunction should store an empty string (a single null character) inthe string pointed to by extension. Keep the function as simple aspossible by having it use the strlen and strcpy functions. Write the following function: void get_extension(const char *file_name, char*extension); file_name points to a string containing a file name. Thefunction should store the extension on the file name in the stringpointed to by extension. For example, if the file name is"memo.txt",the function will store "txt" in the string pointedto by extension. If the file name doesn't have an extension, thefunction should store an empty string (a single null character) inthe string pointed to by extension. Keep the function as simple aspossible by having it use the strlen and strcpy functions.

Explanation / Answer

please rate - thanks #include #include #include void get_extension(const char *file_name, char *extension); int main() {char file_name[20]="memo.txt",extension[20]; get_extension(file_name, &extension); printf("The extension is %s ",extension); getch(); return 0; } void get_extension(const char *file_name, char *extension) {int n,i,len; *extension=''; n=strlen(file_name); for(i=0;i