aboutsummaryrefslogtreecommitdiffstats
path: root/structest.c
blob: 28888e59e7da0f6780e1b242c0b22400ad8044ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <string.h>

struct test {
    char *string;
    int length;
};

int main(int argc, char **argv)
{
    struct test t = {"Testing.", strlen("Testing.")};

    char strbuf[256];

    strncpy(strbuf, t.string, t.length + 1);
    printf("%s\n", strbuf);

    return 0;
}