summaryrefslogtreecommitdiff
path: root/reference/C/CONTRIB/OR_PRACTICAL_C/04_3.c
diff options
context:
space:
mode:
Diffstat (limited to 'reference/C/CONTRIB/OR_PRACTICAL_C/04_3.c')
-rw-r--r--reference/C/CONTRIB/OR_PRACTICAL_C/04_3.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/reference/C/CONTRIB/OR_PRACTICAL_C/04_3.c b/reference/C/CONTRIB/OR_PRACTICAL_C/04_3.c
new file mode 100644
index 0000000..14ee846
--- /dev/null
+++ b/reference/C/CONTRIB/OR_PRACTICAL_C/04_3.c
@@ -0,0 +1,20 @@
+#include <string.h>
+#include <stdio.h>
+
+char first[100]; /* first name */
+char last[100]; /* last name */
+char full_name[200]; /* full version of first and last name */
+
+main()
+{
+ (void)strcpy(first, "Steve"); /* Initialize first name */
+ (void)strcpy(last, "Oualline"); /* Initialize last name */
+
+ (void)strcpy(full_name, first); /* full = "Steve" */
+ /* Note: strcat not strcpy */
+ (void)strcat(full_name, " "); /* full = "Steve " */
+ (void)strcat(full_name, last); /* full = "Steve Oualline" */
+
+ (void)printf("The full name is %s\n", full_name);
+ return (0);
+}