C

Designated initializers

Në shqip: Inicializuesit me emër

ShpjegimiSQ

Që nga C99, mund t'i inicializosh fushat e një struct-i sipas emrit: struct Pika p = { .y = 4, .x = 3 };. Fushat që s'i përmend bëhen 0. Kodi lexohet shumë më qartë.

EnglishEN

Since C99, you can initialise a struct's fields by name: struct Point p = { .y = 4, .x = 3 };. Fields you don't mention become 0. Code reads much more clearly.

Si ta mendosh

Si ta plotësosh formularin duke shkruar „Emri: Arta“ në vend që të shpresosh se kutia e parë është emri.

Lexoje në anglisht

Like filling in a form by writing “Name: Arta” instead of hoping the first box is the name.

Shembull kodic

struct Nxenes a = { .emri = "Arta", .mosha = 16 };
int notat[5] = { [4] = 5 };   // vetëm i fundit

Terma të lidhur