LearnFrenzy
Sign in Take a free test

Memory Allocation · Memory Allocation MCQ · Question 12

What does aligned_alloc() do in C11? Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 12 Back to Exercise

What does aligned_alloc(64, 256) return?

  • A 64 blocks of 256 bytes
  • B A 256-byte block whose address is a multiple of 64, freed with free() Correct
  • C A block on the stack
  • D A 64-byte block aligned to 256
Correct Answer: Option B

The first argument is the alignment, the second the size (which should be a multiple of the alignment). It is used for SIMD data and cache-line alignment, and the block is released with ordinary free().

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Popular