write a program to remove last character from string
Answers
Answered by
2
int main(int argc, char*argv[]) { char *string; char *ptr; string = (char*)malloc(100); puts("Input a String"); fgets(string,100,stdin); printf("Before calling a function: %s]n", string); ptr = strtok(string," "); printf("%s\n", ptr); while(ptr=strtok(NULL, " ")) { ptr[strlen(ptr)-1]=0; printf("%s\n", ptr); } return 0; }
Answered by
1
Answer:
Hope ans is correct fallow me dear!
Attachments:
Similar questions