Q:

Write a program to reverse a string without using library function

0

Write a program to reverse a string without using library function

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
char a[15],temp;
int i,j,l=0;
printf("enter the string :");
scanf("%s",a);
for(i=0;a[i]!='\0';i++)
l++;
i=0;
j=l-1;
while(i<j)
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
i++;
j--;
}
printf("reverse string =%s",a);
getch();
}

Output:

enter the string :aryan
reverse string =nayra

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Programming Exercises With Solutions

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a c program to demonstrate Call by value... >>
<< Write a program to calculation of sum of the digit...