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
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 |
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 |
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 |
#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 |
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 |
Why dont c comments nest?
what is the difference between char * const and const char *?
Do you have any idea about the use of "auto" keyword?
main() { char x; while(x=0;x<=255;x++) printf("\nAscii value %d Charater %c",x,x); }
Why can't I perform arithmetic on a void* pointer?
how do you redirect stdout value from a program to a file?
What is union and structure in c?
Explain the bubble sort algorithm.
What are two dimensional arrays alternatively called as?
what is the associativity of bitwise OR operator?
How to establish connection with oracle database software from c language?
explain how do you use macro?