Computer Science, asked by souvikdas8585, 1 year ago

write a program to remove last character from string

Answers

Answered by sssrohit005p4c0ey
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 sanjureddy
1

Answer:

Hope ans is correct fallow me dear!

Attachments:
Similar questions