state the number of bytes and bits occupied by a character array of 10 elements
Answers
For different compilers, different number of bytes is occupied for various datatypes. For example in C language, memory space occupied for char (character) datatype is 1 byte or 8 bits and for int (integer) datatype, bytes occupied are 2.
Let’s assume that the compiler here is C.
Hence, for a character array of 10 elements,
Number of bytes = 10*1 = 10 bytes
Since, 1 byte contains 8 bits,
Number of bits = 10*8 = 80 bits
Explanation:
For different compilers, different number of bytes is occupied for various datatypes. For example in C language, memory space occupied for char (character) datatype is 1 byte or 8 bits and for int (integer) datatype, bytes occupied are 2.
Let’s assume that the compiler here is C.
Hence, for a character array of 10 elements,
Number of bytes = 10*1 = 10 bytes
Since, 1 byte contains 8 bits,
Number of bits = 10*8 = 80 bits