Skip to content · ⁨דלג לתוכן⁩

Points with a struct · ⁨נקודות עם מבנה (struct)⁩

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.

עברית

נקודות עם מבנה

struct מקבץ ערכים הקשורים זה לזה לסוג אחד. כאן struct Point מכיל x ו-y. השלם שתי פונקציות: make_point בונה ומחזירה Point, ו-move_point מזיז נקודה קיימת. עם רמישה (pointer) למבנה מגיעים לשדות שלו באמצעות ->, ולכן p->x += dx מזיז אותה.

Log in or create account · ⁨היכנס או צור חשבון⁩

IGCSE, A-Level & AP