Rabu, Mei 28, 2014

Join 2 String Value by Using strcat() Function

Example we have program syntax:

main()
{
  char name_of_string1[] = {'L','e','a','r','n','\0'};
  char name_of_string2[] = "C Programming";
  getch();
}


To show by using printf() function:

main()
{
  char name_of_string1[] = {'L','e','a','r','n','\0'};
  char name_of_string2[] = "C Programming";
  printf("%s %s", name_of_string1, name_of_string2);
  getch();
}


If we want to join them by using strcat() function:

main()
{
  char name_of_string1[] = {'L','e','a','r','n','\0'};
  char name_of_string2[] = "C Programming";
  printf("%s", strcat(name_of_string1, name_of_string2));
  getch();
}


Thanks... : )

0 komentar: