#include <stdio.h>
struct node{
int data;
struct node *next;
};
int main() {
/****** 32Bit 64Bit
char 1 1
short 2 2
int 4 4
float 4 4
double 8 8
long 4 8
long long 8 8
long double 16 16
pointer 4 8
wchar_t 2 4 Other UNIX platforms usually have wchar_t 4 bytes for both 32-bit and 64-bit mode.
size_t 4 8 This is an unsigned type.
ptrdiff_t 4 8 This is a signed type.
*/
printf("============== Size of datatypes ==========\n");
printf("char %d bytes\n",sizeof(char));
printf("char ptr %d bytes\n",sizeof(long *));
printf("int %d bytes\n",sizeof(int));
printf("short %d bytes\n",sizeof(short));
printf("long %d bytes\n",sizeof(long));
printf("double %d bytes\n",sizeof(double));
printf("long long %d bytes\n",sizeof(long long));
printf("unsigned int %d bytes\n",sizeof(unsigned int));
//Use pragma to get unpacked value
printf("struct node %d\n",sizeof(struct node));
printf("struct node ptr %d\n",sizeof(struct node *));
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: