Initial commit
This commit is contained in:
22
kapitel11/return-flt-ex1.c
Normal file
22
kapitel11/return-flt-ex1.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
char *say(char namn[]);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char *mening = say("Jack-Benny");
|
||||
printf("%s\n", mening);
|
||||
free(mening);
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *say(char namn[])
|
||||
{
|
||||
char *str;
|
||||
str = calloc(50, sizeof(char));
|
||||
strncat(str, "Hej ", 4);
|
||||
strncat(str, namn, 45);
|
||||
return str;
|
||||
}
|
Reference in New Issue
Block a user