Skip to content

Instantly share code, notes, and snippets.

@echiesse
Last active May 15, 2019 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save echiesse/c349b62478e3036c7754a9ebf422997b to your computer and use it in GitHub Desktop.
Save echiesse/c349b62478e3036c7754a9ebf422997b to your computer and use it in GitHub Desktop.
C sizeof on vars, arrays and malloc
#include <stdio.h>
int main()
{
int a[5];
int b;
int* c = malloc(10 * sizeof(int));
printf("%i\n", sizeof(a));
printf("%i\n", sizeof(b));
printf("%i\n", sizeof(c));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment