LoginSignup
3
1

More than 5 years have passed since last update.

気付きメモ

Posted at

lxrでlivepatch-sample.cを見ててふと気づいた。確かにこういうやり方もあるな。

#include <stdio.h>

struct test_struct {
        int n;
        char *str;
};

struct test_struct foo[] = {
        {
                .n = 10,
                .str = "hello, world",
        },
        {
                .n = 5,
                .str = "foobar",
        }, {}
};

int main(int argc, char **argv)
{
        for (struct test_struct *p = foo; p->str; p++)
                printf("%d: %s\n", p->n, p->str);

        return 0;

}

gcc -std=c11 a.cで。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1