Skip to content
Justice Tech School

typedef

typedef gives a type a new name. It makes struct code shorter.

Example
#include <stdio.h>

typedef struct { int x, y; } Point;
int main(void) {
  Point p = {3, 4};
  printf("%d %d\n", p.x, p.y);
  return 0;
}

Result

3 4

Exercise

Name a type.

 int Id;

Quiz Test

What does typedef create?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.