Just want to know where the data members are in the memory, heap or stack.
Here's my code:
#include <iostream>
#define p(s) std::cout << s << std::endl
class Fook
{
public:
    char c = 'c';  //
    Fook() {
        p(c);
    }
};
class IDK
{
public:
    int* arr = new int[1]; //
    IDK() {
        Fook fook3;        //
        arr[0] = 90;
        Fook* fook4 = new Fook(); //
        p(arr[0]);
    }
};
int main(int argc, char const *argv[])
{
    Fook fook1;
    Fook* fook2 = new Fook();
    
    IDK idk1;
    IDK* idk2 = new IDK();
    return 0;
}
compiles and gives the expected output
c
c
c
c
90
c
c
90
in the above code sample the obj *fook2 and *idk2 are allocated on heap mem and fook1 and idk1 are allocated on stack mem.
- is fook2->con the stack mem (the obj is on the heap mem)
- is *arrinidk1on the heap mem (the obj is on the stack mem)
- is *arrinidk2on the heap mem
- is *fook4in ctor ofidk1on the heap mem
- is fook3in ctor ofidk2on the heap mem
- is *fook4in ctor ofidk2on the heap mem
To summarize everything,
Where are the data members of each object created in int main(int argc, char const *argv[]) in the memory(stack or heap)
 
     
    