Pergunta de entrevista da empresa NVIDIA

how do you implement a sizeof operator without using the sizeof operator

Respostas da entrevista

Sigiloso

14 de jan. de 2013

#define my_sizeof(t) (((t *) 0) + 1)

2

Sigiloso

10 de nov. de 2012

To find the size of a of type tStruct; tStruct *pstruct1 = &structobj; tStruct * pstruct2 = ++pstruct1 ; int size = (char*)pstruct2 - (char*)pstruct1;

1