Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to reverse a String without using C functions ?

Answers were Sorted based on User's Feedback



How to reverse a String without using C functions ?..

Answer / shiva

string Name = "12345";
char[] characters = Name.ToCharArray();
StringBuilder sb = new StringBuilder();
for (int i = Name.Length - 1; i >= 0; --i)
{
sb.Append(characters[i]);
}
Console.Write(sb.ToString());
Console.Read();

Is This Answer Correct ?    4 Yes 0 No

How to reverse a String without using C functions ?..

Answer / dhirendra kumar

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()

{
clrscr();
char a[30],ch[30];
int i,j,count=0,k=0;
printf("enter string in array\n");
gets(a);


for(i=0;a[i]!='\0';i++)
{
count++;
}
printf("length=%d\n",count);
printf("Reverse string===");
for(i=j;i>=0;i--)
{
putchar(a[i]);
}

getch();
}

Is This Answer Correct ?    3 Yes 2 No

How to reverse a String without using C functions ?..

Answer / sakshi pandey

#include<stdio.h>
#include<conio.h>
void main()
{
char str[6],item;
int i,len;
clrscr();
printf("enter a string:\n");
scanf("%s",&str);
len=strlen(len);
for(i=1;i<=len;i++)
{
item=str[i];
str[i]=str[len];
str[len--]=item;
}
printf("reverse string:%s",str);
getch();
}

Is This Answer Correct ?    12 Yes 12 No

How to reverse a String without using C functions ?..

Answer / vinod

char * rev_string (char * str)
{
char temp;
int i , j;
while(str[i]!= '\0')
i++;
for(j = 0 ; j < i ; j++ , i--)
{
temp = str[j];
str[j] = str[i];
str[i] = temp;
}

return str;
}

Is This Answer Correct ?    3 Yes 3 No

How to reverse a String without using C functions ?..

Answer / dhiru

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()

{
clrscr();
char a[30],ch[30];
int i,j,count=0,k=0;
printf("enter string in array\n");
gets(a);

//j=strlen(a);
for(i=0;a[i]!='\0';i++)
{
count++;
}
printf("length=%d\n",count);
printf("Reverse string===");
for(i=count;i>=0;i--)
{
putchar(a[i]);
}

getch();
}

Is This Answer Correct ?    1 Yes 2 No

How to reverse a String without using C functions ?..

Answer / weqweqwe

void mstrreev(char * inStr)
{
if(*inStr!='\0')
{
return;
}
else
{
*/ mstrreev(++inStr);
}
putchar(*(--inStr));
}
void main(int argc, char* argv[])
{

mstrreev("Sushant");
}

Is This Answer Correct ?    0 Yes 3 No

How to reverse a String without using C functions ?..

Answer / abhishek gambhir

int l=0,i;
while(str[l]!='\0')
{
l++;
}
for(i=l-1;i>=0;i--)
{
cout<<str{i];
}

Is This Answer Correct ?    11 Yes 15 No

How to reverse a String without using C functions ?..

Answer / srinivas

#include<stdio.h>

void main()
{
char s[5]="srini";
char *p;
p=(char*)malloc(sizeof(char)*5);
while((*p++=s[--strlen(s)])!='\0');
*p='\0';
printf("%s",p);
}

Is This Answer Correct ?    6 Yes 10 No

How to reverse a String without using C functions ?..

Answer / kalpana

#include<stdio.h>

void reverse( const char * const sPtr );

int main(){
char sentence[ 80 ];

printf( "Enter a line of text:\n" );
gets( sentence );

printf( "\nThe line printed backwards is:\n" );
reverse( sentence );
}

void reverse( const char * const sPtr ){
if( sPtr[ 0 ] == '\0' ){
return;
}
else{
reverse( &sPtr[ 1 ] );

putchar( sPtr[ 0 ] );
}
}

Is This Answer Correct ?    5 Yes 10 No

How to reverse a String without using C functions ?..

Answer / sushamaa

/*The program to reverse the given input string*/

#include<stdio.h>
#include<conio.h>
#include<string.h>

void main()
{
char str[20];
int i=0,a,b;
clrscr();

printf("\nEnter the given string:");
scanf("%s",str);

do
{
a=str[i];
i++;
}while(a!=0);

i=i-1;
printf("\nThe reverse string:");

do
{
b=str[i];
printf("%c",b);
i--;
}while(i>=0);

getch();

Is This Answer Correct ?    9 Yes 17 No

Post New Answer

More C Code Interview Questions

Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.

2 Answers  


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


main() { char *p; p="Hello"; printf("%c\n",*&*p); }

1 Answers  


main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; } a. Runtime error. b. Compile error. Illegal syntax c. Gets into Infinite loop d. None of the above

4 Answers   HCL, LG,


How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!

1 Answers  


#include<stdio.h> main() { struct xx { int x=3; char name[]="hello"; }; struct xx *s; printf("%d",s->x); printf("%s",s->name); }

3 Answers   Hexaware,


String copy logic in one line.

11 Answers   Microsoft, NetApp,


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

1 Answers  


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

0 Answers   TCS,


Write a c program to search an element in an array using recursion

1 Answers   Wipro,


write a origram swaoing valu without 3rd variable

2 Answers  


main() { unsigned char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

1 Answers  


Categories