In C programming, you can pass any kind of pointer you like as an argument to free, how does it know the size of the allocated memory to free? Whenever I pass a pointer to s
malloc() and free() are system/compiler dependent so it's hard to give a specific answer.
malloc()
free()
More information on this other question.