Where do function definitions live? In the stack or in the heap?

Viewed 648

When we define a function, where does it go in terms of memory partitions? On the stack like primitive data types? Or on the heap like objects?

1 Answers

Functions are objects. Therefore, the function’s identifier is in the stack, and the function’s value is stored in the heap.

Related