opgave5-3
This commit is contained in:
@@ -88,6 +88,7 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
||||
@@ -1,6 +1,32 @@
|
||||
#include "main.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void main()
|
||||
{
|
||||
char string[100];
|
||||
int result = strcpy(string, "test");
|
||||
printf("result %d, string %s\n", result, string);
|
||||
|
||||
char s1[100];
|
||||
strcpy(s1, "remco");
|
||||
|
||||
char s2[100];
|
||||
strcpy(s2, "kenneth");
|
||||
|
||||
strCat(&s1, &s2);
|
||||
|
||||
printf("Nieuw string: %s\n", s1);
|
||||
}
|
||||
|
||||
void strCat(char* a, char* b)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
i = j = 0;
|
||||
|
||||
while (a[i] != '\0')
|
||||
i++;
|
||||
while((a[i++] = b[j++]) != '\0')
|
||||
;
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
#pragma once
|
||||
void strCat(char* a, char* b);
|
||||
Reference in New Issue
Block a user