Concatenate two strings in C.
Concatenation in C.
Date Created:Tuesday February 27th, 2007 05:03 PM
Date Modified:Saturday August 02nd, 2008 01:40 PM
#include <stdio.h>
#include <stdlib.h>
int main()
{
char * string;
char first[1024];
char second[1024];
int counted;
printf("Enter a word:\n");
scanf("%s", &first);
printf("%s is your entry\n", first);
printf("Enter another word:\n");
scanf("%s", &second);
printf("%s is your entry\n", second);
counted = strlen(first) + strlen(second);
strncat(first, second, counted);
printf("\n\nHere is ConCat: %s\n",first);
return 0;
}
Downloads:
Download: concat.c 477 B
Please login or Click Here to register for downloads
Concatenate by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com
