0 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 607 views answer comment Share Follow Print See all 2 Comments 2 2 Comments reply Arunav Khare commented Mar 1, 2018 reply Follow flag 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 0 replyShare srestha commented Mar 1, 2018 reply Follow flag u r getting any problem for not using sizeof ? https://stackoverflow.com/questions/2259890/using-sizeof-on-mallocd-memory 0 0 replyShare Please log in or register to add a comment.