Question: Hello i did this program in C language, to reverse a string, it does not build and i dont know what is the issue. thanks

Hello i did this program in C language, to reverse a string, it does not build and i dont know what is the issue. thanks for your help

#include

void reverse(char *); void Lab9c() { char str[50]; char *ptr; printf("Enter a string: "); gets(str); reverse(str); printf("Reversed String is %s ", str);

return 0;

}

void reverse(char *string){ char temp, *begin, *end; begin = string; end = string; for (;*end != '\0'; end++){//the pointer temp points to the last element now } temp--; for (; begin >= end; begin++, end--){ temp = *end; *end = *begin; *begin = temp; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!