Syntax

C Typedef a Struct Syntax

In C, typedef a struct: gives a struct a short type name — typedef struct { int x, y; } Point;

Quick Answer

Syntax
typedef struct { int x, y; } Point;
CSyntax

Typedef a Struct

Code example
typedef struct { int x, y; } Point;

Gives a struct a short type name.

Learn More

How to typedef a struct in C

  1. Open your C file or editor.
  2. Copy the example, then replace its sample names and values for your code.

C Typedef a Struct Syntax

Use typedef struct { int x, y; } Point;.

Related Syntax References

Frequently asked questions

What is the C syntax for typedef a struct?

Use this pattern: typedef struct { int x, y; } Point;

Can I copy this C code example?

Yes. Use Copy code and adapt the example to your program.

Is this C syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify