5 votes 5 votes We use malloc and calloc for: Dynamic memory allocation Static memory allocation Both dynamic memory allocation and static memory allocation None of these Programming in C isro2017 programming-in-c runtime-environment + – sh!va asked May 7, 2017 retagged Dec 9, 2022 by Lakshman Bhaiya sh!va 7.1k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 9 votes 9 votes a) Dynamic memory allocation https://www.programiz.com/c-programming/c-dynamic-memory-allocation Rameez Raza answered May 7, 2017 selected May 8, 2017 by ManojK Rameez Raza comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes dynamic memory allocation a answered May 8, 2017 a comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes malloc() and calloc() both are used to dynamically allocate the memory from heap. Option A Bonus:- malloc() allocates the memory, but doesn't initialize any values. Hence if you try to immediately access the memory contents of a piece of memory allocated through malloc(), you'll get garbage value. calloc() allocates the memory and initializes it to 0. Hence if you try to immediately access the memory contents of a piece of memory allocated through calloc(), you'll get 0. malloc() takes a single argument in which you specify the size of the memory block wanted. calloc() takes two arguments — first, to specify how many blocks you want; second, to specify what size per block you want. JashanArora answered Dec 10, 2019 JashanArora comment Share Follow See all 0 reply Please log in or register to add a comment.