course-c

Introduction

Creating a structure

Initializing structures

Copying and assigning to structures

:::: {.columns}

::: {.column width=”60%”}

:::

::: {.column width=”40%”}

::::

Structures and functions

Pointers to structures

:::: {.columns}

::: {.column width=”60%”}

:::

::: {.column width=”40%”}

:::

::::

Arrays of structures

Typedef

:::: {.columns}

::: {.column width=”40%”}

:::

::: {.column width=”60%”}

  typedef unsigned short UCHAR;
  typedef struct address {
    char * street;
    char * city;
    int zip;
  } Address;

  b = (Address*)
    malloc(sizeof(Address));
  b->street = "street";
  b->city = "recife";
  b->zip = 654321;

:::

::::

Unions

Bit fields

Exercise