Samsung Interview Question
Developer Program Engineers#define getsize(x) ((char *)(&(x) + 1) - (char *)&(x))
int i; getsize(i);
char *strcpy(char *dest, const char *src){
char *save = dest;
while(*dest++ = *src++);
return save;}
Structure padding is adding extra bits at the end of the structue,so that the structure completes the word boundary. Structure padding is used to pad the data in such a way that it can be sent to external devices. Sometimes, the data is padded in such a way that it can be used on little endian vs big endian processors .
number of bits, simple solution:
faster solution (hint from k&r - study difference between x and x - 1)
- petra November 25, 2011