If I have code like this:
const int a=2;
int b;
int main()
{
const int c=4
static int d;
int e;
int f=5;
}
Where in memory (stack, data, heap) are these variables stored(especially the local undefined variable e) ? undefined local variable e will have a garbage value ( where did it come from?)
main
function -----> stack char *arr
, int *arr
) -------> data or stack, depending on the context. C lets you declare a global or a static
pointer, in which case the pointer itself would end up in the data segment.malloc
, calloc
, realloc
) --------> heapIt is worth mentioning that "stack" is officially called "automatic storage class".