Consider the code below -
typedef struct meh {
int a;
bool valid;
} var;
int main(){
var *ptr = calloc(1, sizeof(var));
return 1;
}
I know that calloc by default initializes memory to 0 (or equivalent). Would that still be the case for valid. Is it safe to say that:
ptr->valid;
would always return False (unless explicitly initialised to true) for dereferencing a pointer(like ptr) which was allocated memory using calloc.