@m_s__santos/

space-that-an-array-occupies-in-memory

C

An array occupies in memory the size of its data type multiplied by the number of elements.

fork
loading
Files
  • main.c
main.c
1
2
3
4
5
6
7
8
9
10
11
#include "stdio.h"

int main(void) {
  int nums[10];
  
  int number_of_much_elements = sizeof(nums) / sizeof(int);
  int int_size = sizeof(nums) / 10;
  int space_in_memory = 10 * sizeof(int);
  
  return 0;
}