logo

Concatenating strings in C

#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char* argv[]) { char str1[100] = "My name is "; char str2[] = "Bob Jordan"; strncat(str1, str2, 100 - strlen(str1) - 1); printf("%s\n", str1); return 0; }

Courses with this lesson