Initial commit

This commit is contained in:
2021-10-01 20:24:05 +02:00
commit 860c025165
194 changed files with 4846 additions and 0 deletions

28
kapitel5/struct-test.c Normal file
View File

@@ -0,0 +1,28 @@
#include <stdio.h>
int main(void)
{
struct test1
{
short int a; /* 2 bytes */
/* 2 bytes utfyllnad (2+2=4) */
int b; /* 4 bytes (4) */
char c; /* 1 byte */
char d; /* 1 byte */
/* 2 bytes utfyllnad (1+1+2=4) */
};
struct test2
{
int b; /* 4 bytes (4) */
char c; /* 1 bytes */
char d; /* 1 bytes */
short int a; /* 2 bytes (1+1+2=4) */
};
printf("Storleken av test1: %lu bytes\n",
(long unsigned int)sizeof(struct test1));
printf("Storleken av test2: %lu bytes\n",
(long unsigned int)sizeof(struct test2));
return 0;
}