How to make a reverse string program in c programming language ?

Recommended Answers

All 3 Replies

your link is not valid. But here is how to do it

In place reversal:

char * str <- "something"
char temp
i <- 0
j <- strlen(str) - 1

while (i <= j) do
    temp = str[i]
    str[i++] = str[j]
    str[j--] = temp

On another char*

char * str <- "something"
char rev [strlen(str)]

i <- 0
j <- strlen(str)

for j downto 0 do
    str[j] = rev[i++]
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.