C
Cesar Rodas
Hello to all
As far I know the unsigned char just use 1-byte, long 4-bytes... is
this right???
Well I have the next code...
#include <stdio.h>
#include <stdlib.h>
typedef struct _foo
{
unsigned char lock;
long a;
long b;
unsigned char data[1024];
} bar;
int main(int argc, char *argv[])
{
printf("%d\n", sizeof(bar));
}
/*******************************************************************************/
WHY THE OUTPUT IS 1034? Is need to be 1024 + 4 + 4 + 1 = 1033
Is something wrong?
As far I know the unsigned char just use 1-byte, long 4-bytes... is
this right???
Well I have the next code...
#include <stdio.h>
#include <stdlib.h>
typedef struct _foo
{
unsigned char lock;
long a;
long b;
unsigned char data[1024];
} bar;
int main(int argc, char *argv[])
{
printf("%d\n", sizeof(bar));
}
/*******************************************************************************/
WHY THE OUTPUT IS 1034? Is need to be 1024 + 4 + 4 + 1 = 1033
Is something wrong?