Program to reverse a string in C | How to reverse a string | #1 Coding Bytes

preview_player
Показать описание


Also, to receive placement preparation tips and placement related updates on TCS, Accenture and various other companies. Come join the largest 2020 Passouts Community on FACE’s Telegram and WhatsApp, and take your placement preparation to the next level.

Join here:
Рекомендации по теме
Комментарии
Автор

Such a great idea to print a string in reverse. Now I can see why students just directly print the array in reverse order in the interview.

dayaanraj
Автор

the videos are very nice but Ma'am If you explain the algorithm(like what is happening in the reverse function) it would be better, it will take one or two extra minutes only.

vikrampatel
Автор

Can we have some more questions like this for interview.... Eagerly waiting for the next video.
Really loved the way it is explained.

shreyashsingh
Автор

I totally got it ma'am thank you for explaining ma'am
I just need a little more explanation on [^\n]
I understood that \n for new line and C consider space as a new line but why we have used cap (^)

lalpankaj
Автор

why u didn't use & in scanf??

Rajalakshmi_
Автор

I don't understand...How the recursion is works? Please clarify me..

Seenivasan_
Автор

Understood the recursion portion, and agree that it's very simple. Have never used scanf in format string shown in this video. I think getline( ) would be simpler? Also, if you're to print answer out, iterate backward is just as simple.

huaxzhang
Автор

Code in C++ is as follows whose complexity is O(n/2)
#include<iostream>
using namespace std;
string s;
void rev(int n)
{
if(!(s.length()/2>n))
return;
char ch=s[n];

s[n]=s[s.length()-n-1];
s[s.length()-n-1]=ch;
rev(n+1);

}
int main()
{

cout<<"enter a string :";

cin>>s;
cout<<"Reverse of string is: ";
rev(0);
cout<<s;
}

surajpratap
Автор

python :
n=input().strip()
Print(n[::-1] )

shyamprakashm
Автор

Real this video is different from other because I see lot of video not anyone tell when space comes btw string then what we do for reversing the string 🙏🙏🙏

yogendrasonkar
Автор

Why don't we just traverse the array from its last index to first using a loop to reverse it?

aninditpanigrahi
Автор

Can we have more C programming updated Questions regarding Coding Round in Placement. I am 2022 batch

DristiHandiqueRA
Автор

Traverse from front of array to end how can we print .? Isn't the traversing supposed to be from last element?

vivekkumaranchalia
Автор

can i have a coupon for face placementprep course im realy intrested to take this course

nikhilgoud
Автор

if input is face prep
when the function reverse is at last p of "face pre'p'" where will the flow go for reverse(a+1) in recursive method

cgrreddy
Автор

Hi, how to print subscript and superscript numbers in coding c program? 15-05-22

karunanithir
Автор

is this a recursion method please reply

sirishamamillapalli
Автор

Face prep please solve 2019 official mock test for tcs phase 2

nidhijaiswal
Автор

Thank you ma'am.... Once i was stuck in using scanf with space... Then i used another function for that... But from now i can use scand for that... Thanks alot FacePrep

Ankit-icmw
Автор

If the same question ( using recursion ) ask in TCS phase 2. What happens if I haven't use recursion method but got output by using another method.

Compiler shows error or not ??

selvakumardurai
welcome to shbcf.ru