Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Creating Your First Struct | Introduction to Structs
C Structs
course content

Зміст курсу

C Structs

C Structs

1. Introduction to Structs
2. Pointers and Structs
3. Structs and Memory
4. Advanced Structs Usage
5. Implementing Data Structures

Creating Your First Struct

Using the visual cue at the end of first chapter , let's create a data type to describe a chemical element:

Note

The mass and sequence number cannot be negative, so it would be more efficient to use the unsigned short int data type.

Now, we can “create” a chemical element:

The code will look like this:

Access to struct fields will be discussed in the next chapter.

Try to describe the geometric point A with a structure.

Завдання

  1. Create a structure named Point;
  2. Create a field for the name of the future point;
  3. Create fields for the X and Y coordinates.

Завдання

  1. Create a structure named Point;
  2. Create a field for the name of the future point;
  3. Create fields for the X and Y coordinates.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 4
toggle bottom row

Creating Your First Struct

Using the visual cue at the end of first chapter , let's create a data type to describe a chemical element:

Note

The mass and sequence number cannot be negative, so it would be more efficient to use the unsigned short int data type.

Now, we can “create” a chemical element:

The code will look like this:

Access to struct fields will be discussed in the next chapter.

Try to describe the geometric point A with a structure.

Завдання

  1. Create a structure named Point;
  2. Create a field for the name of the future point;
  3. Create fields for the X and Y coordinates.

Завдання

  1. Create a structure named Point;
  2. Create a field for the name of the future point;
  3. Create fields for the X and Y coordinates.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 4
toggle bottom row

Creating Your First Struct

Using the visual cue at the end of first chapter , let's create a data type to describe a chemical element:

Note

The mass and sequence number cannot be negative, so it would be more efficient to use the unsigned short int data type.

Now, we can “create” a chemical element:

The code will look like this:

Access to struct fields will be discussed in the next chapter.

Try to describe the geometric point A with a structure.

Завдання

  1. Create a structure named Point;
  2. Create a field for the name of the future point;
  3. Create fields for the X and Y coordinates.

Завдання

  1. Create a structure named Point;
  2. Create a field for the name of the future point;
  3. Create fields for the X and Y coordinates.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Using the visual cue at the end of first chapter , let's create a data type to describe a chemical element:

Note

The mass and sequence number cannot be negative, so it would be more efficient to use the unsigned short int data type.

Now, we can “create” a chemical element:

The code will look like this:

Access to struct fields will be discussed in the next chapter.

Try to describe the geometric point A with a structure.

Завдання

  1. Create a structure named Point;
  2. Create a field for the name of the future point;
  3. Create fields for the X and Y coordinates.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 4
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt