You got some of these right, but whoever wrote the questions tricked you on at least one question:
- global variables -------> data (correct)
- static variables -------> data (correct)
- constant data types -----> code and/or data. Consider string literals for a situation when a constant itself would be stored in the data segment, and references to it would be embedded in the code
- local variables(declared and defined in functions) --------> stack (correct)
- variables declared and defined in
heapalso stack (the teacher was trying to trick you)
int *arr) ------->
heapdata or stack, depending on the context. C lets you declare a global or a
staticpointer, in which case the pointer itself would end up in the data segment.
- dynamically allocated space(using
It is worth mentioning that "stack" is officially called "automatic storage class".