Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

explain what is meant by redundancy

Answered: 1 week ago