write a program in reverse the string without using
pointer,array,global variable declaration,lib fun only using
a function?

Answers were Sorted based on User's Feedback



write a program in reverse the string without using pointer,array,global variable declaration,lib f..

Answer / r.s.guptha

void reverse()
{
char c = getchar();
if(c=='\n' || c=='\r')
return;
else
reverse();
putchar(c);
}
int main()
{
reverse();
return 0;
}

Is This Answer Correct ?    4 Yes 3 No

write a program in reverse the string without using pointer,array,global variable declaration,lib f..

Answer / reshma pawar

#include<stdio.h>
void main()
{
int i;
char a[]={"Hello"};
printf("Reverse String is: ");
for(i=4;i>=0;i--)
printf("%c",a[i]);
}

Is This Answer Correct ?    14 Yes 15 No

write a program in reverse the string without using pointer,array,global variable declaration,lib f..

Answer / sanjay

#include<stdio.h>
int main()
{
char a[10],b[10];
int i,c=0;
printf("Enter string");
scanf("%s",a);
for(i=0;a[i]!='\0';i++)
{
c=c+1;
}
for(i=c-1;i>=0;i--)
{
b[j]=a[i];
j++;
}
b[j]='\0';

printf("Reverse the string %s",b);
return 0;
}

Is This Answer Correct ?    6 Yes 11 No

write a program in reverse the string without using pointer,array,global variable declaration,lib f..

Answer / sr amit tyagi

#include<stdio.h>
#include<conio.h>
void main()
{
FILE *f;
char c;
clrscr();
f=fopen("string","w");
while((c=getchar())!=EOF)
{
putc(c,f);
}
fclose(f);
f=fopen("string","r");
fseek(f,-1L,2);
do
{
putchar(getc(f));
}
while(!fseek(f,-2L,1));
fclose(f);
getch();
}

Is This Answer Correct ?    0 Yes 7 No

write a program in reverse the string without using pointer,array,global variable declaration,lib f..

Answer / aravind

#include<stdio.h>
int main()
{
int i;
char a={"Hello"};
for(i=4;i>=0;i--)
printf("revese string=%c",a);
}

Is This Answer Correct ?    7 Yes 32 No

Post New Answer

More C Interview Questions

Why does everyone say not to use scanf? What should I use instead?

0 Answers  


What is the use of a ‘’ character?

0 Answers  


What is key word in c language?

4 Answers   ABC,


What is the difference b/w Structure & Array?

6 Answers  


How to print all the 26 alphabets in this order in C. AbCdEfGh..... it should print dynamically from a to z and do not print this using pgm like this print("Ab......"); Use loops or anything to print all alphabets

2 Answers   Hexaware,






main() { charx; while (x=0;x<=255;x++) printf("\nAscii value %d Character %c,x,x); }

2 Answers  


what is output? main() { #define SQR(x) x++ * ++x int i = 3; printf(" %d %d ",SQR(i),i * SQR(i)); } a)9 27 b)35 60 c)20 60 d)15 175

5 Answers   Wipro,


"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks

0 Answers  


What is alloca() and why is its use discouraged?

1 Answers  


write a program that will print %d in the output screen??

9 Answers   Infosys,


What does the characters “r” and “w” mean when writing programs that will make use of files?

0 Answers  


find out largest elemant of diagonalmatrix

0 Answers  


Categories