0 votes 0 votes int* func() { int* mem = malloc(1024); return mem; } int* mem = func(); Can anyone pls explain the code? Programming in C programming-in-c pointers + – Ahsanul Hoque asked Feb 28, 2018 Ahsanul Hoque 345 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Arunav Khare commented Mar 1, 2018 reply Follow Share malloc(..) is used for allocating memory. So the code allocates a memory of 1024 bytes and provides a pointer (to the first byte) to the variable (a pointer) named mem. 0 votes 0 votes srestha commented Mar 1, 2018 reply Follow Share u r getting any problem for not using sizeof ? https://stackoverflow.com/questions/2259890/using-sizeof-on-mallocd-memory 0 votes 0 votes Please log in or register to add a comment.