offsetof
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
offsetof(struct Nxenes, nota) të tregon sa bajtë larg fillimit të struct-it gjendet një fushë. E dobishme për serializim dhe për idioma si container_of.
EnglishEN
offsetof(struct Student, grade) tells you how many bytes from the start of the struct a field sits. Useful for serialisation and idioms like container_of.
Si ta mendosh
Si të dish në cilin sirtar të dollapit është çdo gjë.
Lexoje në anglisht
Like knowing which drawer of the wardrobe each thing is in.
Shembull kodic
#include <stddef.h>
struct Nxenes { char emri[20]; int nota; };
printf("%zu\n", offsetof(struct Nxenes, nota)); // 20