Initial commit
This commit is contained in:
22
kapitel9/med-initialisering.c
Normal file
22
kapitel9/med-initialisering.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char *a, *b;
|
||||
a = malloc(300);
|
||||
*a = '\0';
|
||||
|
||||
strcat(a, "hej hej");
|
||||
printf("%s\n", a);
|
||||
free(a);
|
||||
|
||||
b = malloc(30);
|
||||
*b = '\0';
|
||||
strcat(b, "hej igen");
|
||||
printf("%s\n", b);
|
||||
free(b);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user