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

could u able to tell about suresoft technical session

1 Answers  


Explain how can I read and write comma-delimited text?

0 Answers  


Why is structure padding done in c?

0 Answers  


Is there any data type in c with variable size?

0 Answers  


how can i get the output 54321 4321 321 21 1 in c programming........???? pls help......

10 Answers   Infosys,






Tell me is null always defined as 0(zero)?

0 Answers  


Are pointers integer?

0 Answers  


What are external variables in c?

0 Answers  


write a c programme for add of two numbers with out use of arthematic operators

2 Answers  


difference between spiral and waterfall model

1 Answers  


enum DAY { sunday, monday, tuesday }; enum EDAYS { friday, saturday, sunday }; void main() { int i =0; if( i == sunday) { printf("%d",i); } } what would be the output?

4 Answers   TCS,


44.what is the difference between strcpy() and memcpy() function? 45.what is output of the following statetment? 46.Printf(“%x”, -1<<4); ? 47.will the program compile? int i; scanf(“%d”,i); printf(“%d”,i); 48.write a string copy function routine? 49.swap two integer variables without using a third temporary variable? 50.how do you redirect stdout value from a program to a file? 51.write a program that finds the factorial of a number using recursion?

6 Answers   Amdocs,


Categories