Anonymous
public c v1 · immutable#include <stdio.h>#include <stdlib.h>#include <string.h>int main(void){ char *buf = malloc(sizeof(char) * 255); char *p = buf; strncpy(buf, "hest", sizeof(char) * 5); printf("%s\n", buf); /* indsæt sanity check så p ikke ryger udenfor*/ p += strlen("hest"); strncpy(p, "lalala", sizeof(char) * 7); printf("%s\n", buf); return(0);}