Malloc question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Malloc question

If I do malloc(10 * sizeof(int)); does it mean that I am allocating 10 ints (taking consideration that int has 4 bytes) ?

20th Jul 2020, 3:14 PM
João Vitor
João Vitor - avatar
2 Answers
20th Jul 2020, 3:22 PM
BroFar
BroFar - avatar
+ 1
Please read the below page to clear your doubt 👇 http://www.cplusplus.com/reference/cstdlib/malloc/
20th Jul 2020, 3:20 PM
Ipang