of

来自「Algorithms for Image Processing and Comp」· 代码 · 共 34 行

TXT
34
字号
@c ----------------------------------------------------------------------
@node offsetof, misc
@heading @code{offsetof}
@subheading Syntax

@example
#include <stddef.h>

size_t offsetof(struct_type, member)
@end example

@subheading Description

This macro returns the byte offset from a structure of type
@var{struct_type} to a member @var{member} therein.

@subheading Return Value

The byte offset

@subheading Example

@example

struct foo @{
  int a;
  int b;
@};

struct foo f;
read(0, (char *)f+offsetof(struct foo, b), 4);
@end example

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?