Home Discussion Discuss: C String Reverse

  • Explanationlavanya June 24, 2011 at 4:22 PM

    string handling functions are not working in LINUX operating System.while compiling its throwing an error.so i need explanation for that and clrscr() function works in c are not?

  • hi here is a small correctionSidharth August 15, 2011 at 9:05 PM

    replace while with if condition, it works well otherwise it gives output as dello worlh

  • REVERSE A STRINGGaurav September 7, 2011 at 10:16 AM

    A good and understandable program. I like it.

  • correctionnitesh September 29, 2011 at 10:08 PM

    change if loop to for loop; other wise it wont work totally.only the first and last are reversed ,other will remain same if u use if.

  • ANother method :PMegatron October 2, 2011 at 3:20 PM

    #include<stdio.h> #include<conio.h> void rev(char *,char *,int ); int main() { char ch[10],r[10]; scanf("%s",ch); rev(ch,r,strlen(ch)); printf("%s ",r); getch(); return 0; } void rev(char *p,char *q,int n) { //static int i=0; if((n--)>0) { *(q++)=*(p+n); rev(p,q,n); } else *q='\0'; }

  • reversing a stringsudhir October 13, 2011 at 3:06 PM

    the program works fine. But for a beginner why it void main ? where the new function call has to be sent. what are the called parameters. that too without using built in function it is bit clumsy to understand. please show it in algorithmic way first and then give the solution please, thanks, / sudhir

  • Correct the above codeuday December 4, 2011 at 10:46 PM

    #include <stdio.h> #include <string.h> int reverse(int i); char st[]="Hello World"; main() { printf("\nThe string is: %s", st); reverse(0); printf("\nReversed string is: %s", st); } int reverse(int i) { while (i<(strlen(st)/2)) { char c; c= st[i]; st[i]=st[strlen(st)-i-1]; st[strlen(st)-i-1]=c; i++; } return 0; }

  • wrong codePankaj April 5, 2012 at 2:48 PM

    I have tried this code,but the result is not correct.This code is not perfect.Make it correct

  • c++niyati gandhi July 29, 2012 at 1:26 PM

    nice one...............

  • stringreversejaneperez November 26, 2012 at 12:27 PM

    tnx for this useful code :D it help's me a lot :*

  • easy but hardk.premalatha June 24, 2013 at 8:28 PM

    hi it's understandable but little bit tough.......

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
Java Beginners

reverse
reverse  program to read a string and print the reverse string  ... ReverseString{ public static void main(String[]args){ Scanner input=new Scanner(System.in); System.out.print("Enter String: "); String st 

Java Interview Questions

reverse string
reverse string  how to reverse a string without changing its place...=input.nextLine(); String reverse = new StringBuffer(str).reverse().toString...{ public static void main(String[]args){ Scanner input=new Scanner 

Java Beginners

Reverse string in BlueJ
Reverse string in BlueJ  wap that user enter a string and one word. so i want that program search word in string entered by user if word exist in string than reverse only that word and give output. e.g This is a flower (string 

Java Interview Questions

String reverse program
String reverse program  write a java program for reverse string? if the string is "Hi welcome to hyderabad" the reverse string is "hyderabad... for help. You can split the String into String array using split method of String 

Java Beginners

string reverse order
string reverse order  Hi I have string s= " kalins naik" then how can i print string s=" naik kalins" Thanks kalins naik   import java.util.*; public class ReverseWords{ public static void main(String[] args 

Java Beginners

reverse the charstring
reverse the charstring  how to reverse any character of the string 

Java Beginners

print reverse string without api
print reverse string without api  accept a string and print reverse without using api 

Java Beginners

A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer 

Java Beginners

A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer 

Java Beginners

A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer 

Java Beginners

A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer 

Java Beginners

A Program To Reverse Words In String in Java .
A Program To Reverse Words In String in Java .  A Program To Reverse Words In String in Java :- For Example :- Input:- Computer Software Output :- Software Computer 

Java Interview Questions

Getting the string in reverse
Getting the string in reverse  i am giving the string=" i am sachin".for this output is "sachin am i".please give me the code?   Hi Friend, Visit Here Thanks 

Java Interview Questions

Getting the string in reverse
Getting the string in reverse  i am giving the string=" i am sachin... static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter String: "); String st=input.nextLine 

Java Beginners

Reverse word of string in alphabetical order
Reverse word of string in alphabetical order  wap a program that reverse word of string in alphabetical order. e.g. input by user The purpose of education is to replace an empty mind with an open one output 

Core Java

String reverse in java
String reverse in java In this section we are going to discuss about how to reverse a sting in java. There are many ways to reverse a string in java ... can easily reverse a string, this is the most easy way to reverse a string 

Java Tips and Examples

String Reverse in Java
String Reverse in Java       In this example we are going to reverse a given string... the input string by using the StringBuffer(String string) method, reverse 

Programming Tutorials

JavaScript reverse text string
JavaScript reverse text string...; In this section, we are going to reverse the text string using JavaScript..., you will get the reverse string in the same text box. Here is the code 

Java Beginners

A Program To Reverse Words In String in Java
A Program To Reverse Words In String in Java  A Program To Reverse Words In String in Java for example: Input:- Computer Software Output... Tell Me This Program.  Here is an example that reverse the words 

Java-Tutorials

String Reverse In Java Example
String Reverse In Java Example In this tutorial we will read about reversing... reverse value. Reversing a String is an operation to represent an original String... to display the String in reverse order. Syntax of StringBuilder reverse() method 

Java Tips and Examples

String Reverse Using StringUtils
String Reverse Using StringUtils       In this example we are going to reverse a given string using... and String.trim() for trim. The methods used: reverse(String str 

General

Java Reverse String Pattern
Java Reverse String Pattern In this section, we have displayed a string in reverse pattern. For this,we have specified a string which is first converted... StringBuffer(st).reverse().toString() and gain convert this string into character 

Programming Tutorials

Reverse String using Stack
Reverse String using Stack You all are aware of Stack, a data structure... in the reverse order from that in which they are added. The push operation is responsible for adding the element and pop for removing. Here we are going to reverse 

Development process Questions

reverse albhabet
reverse albhabet   e d c b a d c b a c b a code for this pattern   Here is a code that displays the following pattern: e d c b a d c b a c b a b a a public 

Core Java

Reverse String Program in Java
Reverse String Program in Java We are going to describe about reverse...[]) { String string, reverse = ""; Scanner in = new Scanner...); System.out.println("Reverse of entered string is: "+reverse 

C Tutorials

C String Reverse
C String Reverse       In this section, you will study how to reverse a string. You can see... strlen(). Then string st[i] and st[strlen(st)-i-1] are swapped as: c= st[i 

Java Interview Questions

how to reverse a string without changing its place
how to reverse a string without changing its place  how to reverse a string without changing its place   Hi Friend, Another way of reversing string: import java.util.*; public class ReverseString{ public static 

General

Java Reverse words of the String
Reverse words of the String Java Programming In this section, we are going to reverse the words of the string. For this, we have allowed the user to enter the string. Then we have converted the string into tokens using StringTokenizer 

Java Code Examples

Java reverse words in a string using only loops
Java reverse words in a string using only loops In this tutorial, you will learn how to reverse words in a string without using any inbuilt methods like...;=c.length;i++) { if(i==c.length) { reverse(c,word_start_index,i-1); } else 

Java Beginners

reverse words in a string(words seperated byone or more spaces)
reverse words in a string(words seperated byone or more spaces)  reverse words in a string(words separated by one or more spaces 

DMCA.com