Shilpa Shilpa - 1 month ago 9
C Question

How to declare a memory of size n x n in c.

I am working on compiler design for 8051. I want to declare a memory of say 30 locations, each location is of 8bits. How do I declare that in C?

Answer

to declare 30 x 8 bits memory:

char memory[30];

to declare n x n memory:

char memory[30][30];

it declares 30 x 30 x 8bits memory.