-->

Facebook

Jasper Roberts - Blog

Wednesday, April 8, 2015

Find given string is palingrom or not using string library function.

#include<stdio.h>
#include<conio.h>

void main()
{
   char str1[50], str2[50];
   clrscr();

   printf("\n Enter the first string:");
   gets(str1);

   strcpy(str2,str1);
 
strrev(str2);

   if (strcmp(str1,str2) == 0)
{
      printf("Entered string is a palindrome.\n");
}
   else
{
      printf("Entered string is not a palindrome.\n");
}

 getch();
}
OUTPUT:
Enter the first string: rever
Entered string is a palindrome.

Write a C program to copy one string to another string.

#include <stdio.h>
#include <string.h>


void main()
{
   char str1[50], str2[50];
   clrscr();

  printf("\n enter first string:");
gets(str1);

  printf("\n enter second string:");
gets(str2);

  printf("\n Before Copy String s1 is: %s",str1);

strcpy(str1,str2);

   printf("\n After Copy String s1 is: %s", str1);

getch();
}
Write a C program to copy one string to another string.
Copy String

Write a program to join two strings.

#include <stdio.h>
#include <string.h>


void main()
{
   char str1[50], str2[50];

  printf("enter first string:");
gets(str1);

  printf("enter second string:");
gets(str2);

strcat(str1,str2);


   printf("String : %s", str1);

getch();
}
Write a program to copy one string to another string.
string copy