Search This Blog

Thursday, October 13, 2011

Write a program to read two strings and append second to first

   1:  #include<stdio.h>
   2:  #include<conio.h>
   3:  #include<string.h>
   4:  void main()
   5:  {
   6:  char str1[40];
   7:  char str2[40];
   8:  printf("Enter the first string:\n");
   9:  gets(str1);
  10:  printf("Enter the second string:\n");
  11:  gets(str2);
  12:  strcat(str1,str2);
  13:  printf("String 1 is now:\n");
  14:  puts(str1);
  15:  getch();
  16:  }

No comments:

Post a Comment