[ create a new paste ] login | about

Link: http://codepad.org/DQcGIFy3    [ raw code | output | fork ]

C, pasted on Feb 11:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>

typedef struct type1_t {
    const char *s;
} type1_t;

typedef struct type2_t {
    const char *s1;
    const char *s2;
} type2_t;

int main(void) {
    type1_t test1 = {"foobar"};
    type2_t test2 = {"foo", "bar"};
    printf("test1.s: %s\n", test1.s); /* Prints "foobar" */
    printf("test2.s1: %s\n", test2.s1); /* Should print "foo"; doesn't */
    printf("test2.s2: %s\n", test2.s2); /* Should print "bar"; doesn't */
    return 0;
}


Output:
1
2
3
test1.s: foobar
test2.s1: foo
test2.s2: bar


Create a new paste based on this one


Comments: