Skip to content

Instantly share code, notes, and snippets.

@ilmoralito
Created January 22, 2022 02:56
Show Gist options
  • Save ilmoralito/9cd1ec7d888f1b03bb2fbd3c9ff18010 to your computer and use it in GitHub Desktop.
Save ilmoralito/9cd1ec7d888f1b03bb2fbd3c9ff18010 to your computer and use it in GitHub Desktop.
C sizeof example
#include <stdio.h>
int main(void)
{
printf("char size: %lu bytes\n", sizeof(char));
printf("int size: %lu bytes\n", sizeof(int));
printf("short size: %lu bytes\n", sizeof(short));
printf("long size: %lu bytes\n", sizeof(long));
printf("float size: %lu bytes\n", sizeof(float));
printf("double size: %lu bytes\n", sizeof(double));
printf("long double size: %lu bytes\n", sizeof(long double));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment