answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

{

char str1[]="ravi kant yadav";

char str2[20],*p1,*p2;

clrscr();

p1=str1+strlen(str1)-1; //Make p1 point to end of str1.

p2=str2;

while(p1>=str1)

*p2++=*p1--;

*p2='\0';

printf("Original string=%s. Reversed String=%s",str1,str2);

getch();

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

What is the use of Reverse String in C program?

The use of the reverse string in C program is used to reverse the letters in the string. An example would be reverse me would be reversed to em esrever.


How do you convert a number that consist of alphabet and number in reverse order?

To reverse a number, first convert the number to a string, then reverse the string. Given your number consists of alphanumeric characters, the number must already be a string so simply reverse the string: #include&lt;string&gt; using std::string; string reverse (const string&amp; s) { string str {}; for (auto c : s) str.insert (str.begin(), c); return str; } int main () { std::cout &lt;&lt; "Enter a number: "; string s {}; std::cin &gt;&gt; s; std::cout &lt;&lt; "The number in reverse is: " &lt;&lt; reverse (s); }


How do you make a program to reverse nummber in c language?

I'd use sprintf (assuming the number wasn't a string already) and pointers. If that's not enough of a clue, you're really not ready to be in this programming class.


What are the pointers in computer programming using c?

addresses


Print reverse string in c sharp?

To print a reverse string in C#, you can use the Array.Reverse method or LINQ. Here's a simple example using Array.Reverse: string original = &quot;Hello, World!&quot;; char[] charArray = original.ToCharArray(); Array.Reverse(charArray); string reversed = new string(charArray); Console.WriteLine(reversed); This code converts the string to a character array, reverses the array, and then creates a new string from the reversed array before printing it.


Write a flowchart of reverse the string in c?

wefwfe


Piglatin string in c without using pointer?

Sure, you can write a function in C to convert a string to Pig Latin without using pointers by passing the string as a parameter and manipulating it directly within the function. You can split the string into words, check if a word starts with a vowel or consonant, and then apply the appropriate transformation following the rules of Pig Latin. Remember to allocate enough memory for the modified string to prevent buffer overflow.


How do you get value of a string in reverse order in c?

Assume C#, not C: Traditional way: public string Reverse(string s) { if (string.IsNullOrEmpty(s)) return s; // "" or null char[] characters = s.ToCharArray(); Array.Reverse(characters); return new string(characters); } or as an extension method: public static string Reverse(this string s) { if (s == "") return ""; char[] characters = s.ToCharArray(); Array.Reverse(characters); return new string(characters); } The differences of the 2 methods above is on the caller (how to use Reverse()), and they may co-exist: For example: string test = "abc"; string result1 = Reverse(test); // traditional way string result2 = test.Reverse(); // call the extension


How to write a C program to find largest 2 numbers using pointers?

program to find maximum of two numbers using pointers


Do you have pointer concept in c plus plus language?

Yes. All string variables are pointers as are other arrays.


How do you find the biggest of n numbers using pointers in C?

yes


How do you write a reverse function in C plus plus without pointers?

You can either use references or you can simply return the result by value. Note that in C++, unlike C, references are not the same as pointers. C++ references are aliases, alternate names for existing objects, whereas pointers are just variables that may contain a memory address that can be dereferenced.