-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrings.c
More file actions
31 lines (28 loc) · 850 Bytes
/
strings.c
File metadata and controls
31 lines (28 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <errno.h>
int main() {
char greeting[6] = {'H', 'e', 'l', 'l', 'o', '\0'};
printf("Greeting message: %s\n", greeting );
char str1[12] = "Hello";
char str2[12] = "World";
char str3[12];
int len ;
// copy str1 into str3
strcpy(str3, str1);
printf("strcpy( str3, str1) : %s\n", str3 );
// concatenates str1 and str2
strcat( str1, str2);
printf("strcat( str1, str2): %s\n", str1 );
// total lenghth of str1 after concatenation
len = strlen(str1);
printf("strlen(str1) : %d\n", len );
return 0;
}
// Bro Code. (2021.10.7.). C Programming Full Course for free [Video]. YouTube. https://www.youtube.com/watch?v=87SH2Cn0s9A