how do i do this problem? the problem require to write a function that accepts a string (a pointer to a character) and deletes the last character by moving the null character one position to the left.Code:#include <stdio.h> char* LastcharDel(char* name); int main () { // declarations char name[20]; printf("Enter your name:\n"); scanf("%s", name); // fucntion calls LastcharDel(name); printf(" your name without last character : %s\n\n", name); return 0; } char* LastcharDel(char* name) { int i = 0; for(i =0; i< 20; i++) { if(i > 1) name[i- 1] = '\0'; } return name; }
Also write a main function that inputs your family name, calls this function, and then ourputs your family name after the call (it should be missing the last letter at this point). Copy your code and the output (as a comment at the bottom of the code) as run by entering your name.
the code above is what i got so far