Size of program

i want to know about size of program specially if i put using array int a[10]
then wht size computer will take such as 4 byte or 40 byte i get confused too many times
each of array’s block will take 4 byte size ?

Welcome to the learnvern community.

The size of the array will depend on the data type and the number of array elements. the datatype int takes 2 bytes, char 1 and float 4 bytes. you can find the array size by multiplying the total number of array elements by the by the byte size of the data type.

For example : int student[10];

here we have an array named student with 10 array elements. An int occupies 2 bytes of memory . So array size would be

array size = number of array elements * bytes occupied by the datatype
= 10 * 2 = 20 bytes.

Example 2: char name [30];

now since char occupies only 1 byte array size would be = 30 * 1 = 30 bytes