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 نقطة موجودة مسبقًا. باستخدام مؤشر إلى بنية، تصل إلى حقولها باستخدام ->، لذلك يحرك p->x += dxها.

Log in or create account · ⁨تسجيل الدخول أو إنشاء حساب⁩

IGCSE, A-Level & AP