0 votes 0 votes queue->array = (int*) malloc(queue->capacity *sizeof(int)); What is queue->capacity * doing here? Programming in C programming-in-c memory-management + – Ahsanul Hoque asked Mar 16, 2018 Ahsanul Hoque 287 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Devshree Dubey commented Mar 17, 2018 reply Follow Share You know that the function of malloc() is to dynamically allocate memory. (int *) malloc(n*sizeof(int)). Here n is the size of the list or the number of items that are present in the list. In a similar manner queue capacity refers to the number of items/elements that are present in ur queue. I hope this helps. If still not able to understand please share ur piece of code here. Will try to explain it line by line. queue->capacity refers to the size of the elements or the number of elements that are there in ur list. 1 votes 1 votes shiva0 commented Apr 6, 2019 reply Follow Share malloc() function takes one parameter.if we pass 3 as parameter for malloc i.e., malloc( 3 ) it dynamically allocates 3 bytes of memory. As for your question malloc(queue->capacity *sizeof(int)); here queue->capacity is how many elements you want to insert into your object queue, and memory in bytes for those number of elements should should be created thats why we are multiplying queue->capacity with sizeof(int) and, sizeof(int) specifies 4 bytes for 32bit system. i hope this is clear for you...! 0 votes 0 votes Please log in or register to add a comment.