c - What memory space is occupied by auto variables in stack -


i read functions in c may use local stack-based variables, , allocated decrementing stack pointer amount of space required. done in four-byte chunks (if not mistaken). but, if run code following:

 void foo(void) {    char str[6];    ...... } 

what size var str occupy? 6 bytes or 6 × 4 bytes per four-byte chunks.

the four-byte-chunk rule means stack pointer must point address multiple of four. in case, allocating 8 bytes satisfies rule, , such block large enough hold 6-character array 2 bytes of padding.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -