You are not logged in. Please login at to post your questions!


How to declare a memory block of required dimensions in C?

I want to declare a memory block of size 256 bytes each of 16x16 bytes.
Using malloc(256) we can declare 256 bytes.But I want it as 16x16 bytes.Any one help me??

asked 07 Jul '16, 10:16

pallesai's gravatar image

accept rate: 17%

You are talking about a 2 dimension array, each element of 16 size and has 16 such elements?

(12 Jul '16, 00:25) bradley3★

You can create an array of 16 elements and within a for loop

Use arr[i] = malloc(16);


answered 12 Jul '16, 00:29

bradley's gravatar image

accept rate: 20%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 07 Jul '16, 10:16

question was seen: 565 times

last updated: 12 Jul '16, 00:29