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 dont c comments nest?

0 Answers  


what is the difference between char * const and const char *?

2 Answers   TCS,


Do you have any idea about the use of "auto" keyword?

0 Answers  


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

2 Answers  


Why can't I perform arithmetic on a void* pointer?

0 Answers  






how do you redirect stdout value from a program to a file?

1 Answers  


What is union and structure in c?

0 Answers  


Explain the bubble sort algorithm.

0 Answers  


What are two dimensional arrays alternatively called as?

0 Answers  


what is the associativity of bitwise OR operator?

1 Answers  


How to establish connection with oracle database software from c language?

0 Answers  


explain how do you use macro?

0 Answers  


Categories