Aggregate & designated initialization (C++)
Në shqip: Inicializimi i struct-eve në C++
ShpjegimiSQ
Struct-et e thjeshta inicializohen me kllapa gjarpër: Pika p{1, 2};. Që nga C++20 mund të përdorësh edhe emrat: Pika p{.x = 1, .y = 2};.
EnglishEN
Simple structs are initialised with curly braces: Point p{1, 2};. Since C++20 you can use the names too: Point p{.x = 1, .y = 2};.
Si ta mendosh
Si ta plotësosh formularin duke shkruar „Emri: Arta“.
Lexoje në anglisht
Like filling in a form by writing “Name: Arta”.
Shembull kodicpp
struct Pika { int x = 0, y = 0; };
Pika a{1, 2};
Pika b{.y = 5}; // x = 0