Here’s a simple example:
#include <cstdint>
class A {
public:
int a;
uint16_t b;
};
#include <iostream>
int main () {
using namespace std;
A c;
cout << c.a << endl;
cout << c.b << endl;
}
I am getting random integers outputted, but from other SO answers and online — my expectation was that integers and primitives are ZERO initialized in C++. Why is this not the case?
From my understanding, for class
members, the constructor is called, if applicable