Question: recursive way to print of an string by using pointer.. I want the clear explanation of how does these work // recursive print of a
recursive way to print of an string by using pointer..
I want the clear explanation of how does these work
// recursive print of a string
void print(char* s)
{
if(*s==__char(0)___) return;
cout<<*s;
print(__s+1___);
}
void main(){ char a[6]="hello";
print(a);
}
// recursive reverse print of a string
void rev_print(char* s)
{
if(*s==__char(0)__) return;
___cout<<*s______;
___print(s+1)____;
}
void main()
{ char a[100];
cin>>a;
rev_print(a);
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
