Skip to content · ⁨Lompat ke konten⁩

Points with a struct · ⁨Titik dengan struktur⁩

English

Points with a struct

A struct groups related values into one type. Here struct Point holds an x and a y. Complete two functions: make_point builds and returns a Point, and move_point shifts an existing one. With a pointer to a struct you reach its fields with ->, so p->x += dx moves it.

Bahasa Indonesia

Poin dengan struct

Sebuah struct mengelompokkan nilai-nilai terkait menjadi satu tipe. Di sini struct Point menyimpan sebuah x dan sebuah y. Lengkapi dua fungsi: make_point membangun dan mengembalikan Point, dan move_point menggeser yang sudah ada. Dengan pointer ke struct Anda mencapai field-fieldnya dengan ->, jadi p->x += dx memindahkannya.

Log in or create account · ⁨Masuk atau buat akun⁩

IGCSE, A-Level & AP