Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-std=c99 -Wall -Wextra -Wpedantic -Wshadow
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- typedef struct Testas {
- int i;
- char c;
- } Testas;
- int main (int argc, char **argv)
- {
- unsigned int uiTmp = 3;
- //={0}; error: variable-sized object may not be initialized
- Testas tst[uiTmp];
- //memset( tst, 0, sizeof(Testas)*uiTmp);
- memset( tst, 0, sizeof(tst));
- printf("size of Testas: %zu\n",sizeof(Testas));
- printf("size of tst: %zu\n",sizeof(tst));
- for(unsigned int i = 0; i < uiTmp; ++i)
- {
- printf("%d %d\n", tst[i].i, tst[i].c);
- }
- return 0;
- }
- /*
- size of Testas: 8
- size of tst: 24
- 0 0
- 0 0
- 0 0
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement