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 / shruti

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

for(j = 0 ; j < i ; j++ , i--)
{
temp = str[j];
str[j] = str[i];
str[i] = temp;
}

return str;
}

Is This Answer Correct ?    32 Yes 28 No

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

Answer / yogesh

#include<stdio.h>
int main()
{
char str[80],str1[80];
int i,j;
printf("\n Enter String:");
fgets(str,80,stdin);
for(i=strlen(str)-1,j=0;i>=1;i--)
str1[j++]=str[i];
printf("Reversed String is:%s",str1);
}

Is This Answer Correct ?    18 Yes 14 No

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

Answer / savita chauhan

#include<stdio.h>
#include<conio.h>
int reverse(char *)
void main()
{
char a[];
int i,l;
clrscr();
printf("\n Enter the string");
gets(a);
l=reverse(a)-1;
printf("\n\n\n");
printf("\n Reverse is:");
while(l>=0)
{
printf("%c",a[l]);
l--;
}
getch();
}
int reverse(char *p);
{
int i=0;
while(*p!='\0')
{
i++;
p++;
}
return i;
}

Is This Answer Correct ?    10 Yes 6 No

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

Answer / amit soni

#include<stdio.h>
void main()
{
int i,j;
char a[10];
printf("Enter your string which you want to reverse");
gets(a);
for(i=0;a[i]!=NULL;i++);
for(j=i-1;j>=0;j--)
printf("%c",a[j]);
getch();
}

Is This Answer Correct ?    14 Yes 10 No

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

Answer / summit sehgal

char * rev(char * str)
{
char *str2; int n=0;
while (*str!='\0')
{
*(str2+n)=*(str(strlen(str))-n);
n++;
}
*str2='\0';
str=str2;
return(str);
}

Is This Answer Correct ?    4 Yes 0 No

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

Answer / muthu18.gs

void strrev(char *str)
{
int i;j=strlen(str),l;
l=j/2

for(i=0,j=j-1;i<=l;str[i]^=str[j]^=str[i++]^=str[j--]);
}

Is This Answer Correct ?    4 Yes 0 No

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

Answer / vivekanandan

#include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
{
int len=0;
char str[100];
clrscr();
printf("\nEnter the string");
gets(str);
while(str[len]!='\0')
{
len++;
}
printf("\nThe Reverse of the string is");
for(int i=0;i<=len;i++)
{
printf("%c",str[len-i]);
}
getch();
}

Is This Answer Correct ?    5 Yes 1 No

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

Answer / neelu

#include<stdio.h>
#include<string.h>
main()
{
char a[10],b[10];
int i,l;
printf("enter the string to be reversed");
scanf("%s",a);
l=strlen(a);
for(i=0;i<l;i++)
b[i]=a[l-1-i];
b[i]='\0';
printf("%s",b);
}

Is This Answer Correct ?    4 Yes 0 No

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

Answer / abhijit s k

#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[] = "test string";
char revstr[50];
int i=0,j;
printf("Original string is %s",str);
for(j = strlen(str) - 1;j>= 0;j --)
{

revstr[i] = str[j];
i++;
}
printf("\n Post reversal,string is %s",revstr);
return 0;
}

Is This Answer Correct ?    4 Yes 0 No

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

Answer / ken paul bahinting

#include<stdio.h>
#include<string.h>
main()
{
char a[10],b[10];
int i,l;
printf("enter the string to be reversed:");
gets(a);
l=strlen(a);
for(i=0;i<l;i++)
b[i]=a[l-1-i];
b[i]='\0';
printf("The reversed string is %s\n",b);
}

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { float i=1.5; switch(i) { case 1: printf("1"); case 2: printf("2"); default : printf("0"); } }

2 Answers  


Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];

1 Answers  


Declare an array of N pointers to functions returning pointers to functions returning pointers to characters?

1 Answers  


find A^B using Recursive function

2 Answers  


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


What are the files which are automatically opened when a C file is executed?

1 Answers  


What is the hidden bug with the following statement? assert(val++ != 0);

1 Answers  


There is a lucky draw held every day. if there is a winning number eg 1876,then all possible numbers like 1867,1687,1768 etc are the numbers that match irrespective of the position of the digit. Thus all these numbers qualify fr the lucky draw prize Assume there is no zero digit in any numbers. write a program to show all the possible winning numbers if a "winning number"is passed as an arguments to the function.

1 Answers   Nagarro,


main() { char *a = "Hello "; char *b = "World"; clrscr(); printf("%s", strcpy(a,b)); } a. “Hello” b. “Hello World” c. “HelloWorld” d. None of the above

4 Answers   Corporate Society, HCL,


main(){ char a[100]; a[0]='a';a[1]]='b';a[2]='c';a[4]='d'; abc(a); } abc(char a[]){ a++; printf("%c",*a); a++; printf("%c",*a); }

2 Answers  


Print an integer using only putchar. Try doing it without using extra storage.

2 Answers  


what is brs test reply me email me kashifabbas514@gmail.com

0 Answers  


Categories