C examples for Structure:Structure Value
Check the offset of a structure field
#include <stdio.h> #include <stddef.h> struct car/* ww w .j a va2 s. c o m*/ { char brand[30]; char model[30]; double hp; double price; }; int main(void) { size_t into = offsetof(struct car, hp); /* offset of hp member */ printf("%zd\n", into); return 0; }