Write a C program to reverse the string without using library function

In this article we will learn how to reverse the string without using library or string function in C language.

reverse the string without using library function

Answer:

#include<stdio.h>
#include<conio.h>
int main()
{
char a[11]="PROGRAMMING";
char b[12];
int i,j;
clrs__cr();

  for(i=0;i<11;i++)
  {
    for(j=10;j>=0;j--)
     {
       b[i]=a[j];
       i++;
     }
  }

  b[i]=NULL;
  printf("String=%s\n",b);
  getch();
  return 0;
}

____________________________________________________

reverse the string without using library function
______________________________________________________

Post a Comment (0)
Previous Post Next Post