answersLogoWhite

0


Best Answer

#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

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How to Reverse a string using pointers in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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


Write a flowchart of reverse the string in c?

wefwfe


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

program to find maximum of two numbers using pointers


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


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


What are the applications of pointers in using c language?

Accessing data by address. Some data-structures, like lists and trees, are usually implemented using pointers.


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.


How can you access the administrator password using pointers in C?

i don't have any knowledge about your ques. but i guide you to read the "Writing TSR through C" &amp; learn knowledge of FAR &amp; HUGE ponters.by this you can access the adminstrator password using pointers in C.