write a c program to Reverse a given string using string
function and also without string function



write a c program to Reverse a given string using string function and also without string function..

Answer / puneet mittal

#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char string[50],reverse[50];
int i,len=0;
printf("Enter the string = ");
gets(string);
strrev(string);
printf("\n reverse of entered string by using string
function : %s",string);
for(i=0;i<50;i++)
{
if(string[i]!='\0')
len++;
}
for(i=0;i<len;i++)
{
reverse[i]==string[len-i];
}
printf("\n\nreverse of entered sting without using
string function :%s ",reverse);
getch();
}

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { char a[4]="HELL"; printf("%s",a); }

3 Answers   Wipro,


main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }

3 Answers  


prog. to produce 1 2 3 4 5 6 7 8 9 10

4 Answers   TCS,


given integer number,write a program that displays the number as follows: First line :all digits second line : all except the first digit . . . . Last line : the last digit

8 Answers  


Give a one-line C expression to test whether a number is a power of 2.

10 Answers   Microsoft,






respected sir, i did my MCA in 2013 when i am going to attend to an interview i was asked about my project how will i explain my project could please help me in this and my project title is "Social Networking Site For Social Responsibility"

1 Answers   Genpact, Ozdocs,


Given n nodes. Find the number of different structural binary trees that can be formed using the nodes.

16 Answers   Aricent, Cisco, Directi, Qualcomm,


main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d ", x--); } } a. 5, 3, 1 b. 5, 2, 1, c. 5, 3, 1, -1, 3 d. –3, -1, 1, 3, 5

2 Answers   HCL,


main() { unsigned int i=65000; while(i++!=0); printf("%d",i); }

1 Answers  


struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }

1 Answers  


create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

0 Answers   Microsoft,


main() { clrscr(); } clrscr();

2 Answers  


Categories