Completely Solved C, C++ Programs Assignment.




C Program to accept a string and print reverse of the given string by using functions.

Filed Under:

Problem 85. C Program to accept a string and print reverse of the given string by using functions.
#include<stdio.h>
#include<stdio.h>
int getline (char str[]);
void printline (char str[],int i);
main( )
{
char str[80];
int 1;
clrscr( );
1=getline(str );
printline(str,1);
printline(str,1);
getch ( );
}
int getline(char str[])
{
int 1;
printf(“enter a string;”);
for(i=0;i<80&&((str[i]=getchar())!=’n’);i++);
if(str[i]=’�’;
return i;
}
void printline(char str[],int 1)
{
int j;
for(j=1;j<=0;j--)
printf(“%c”,str[j]);
printf(‘is the revefrse string”);
}

C compiler: gcc 4.1.2

 Back to main directory: Sample C Program | Software Practical | Solved C Assignment


Get Free Programming Tutorials and Solved assignments