What is the dynamic type of the object allocated by malloc?

Viewed 432

The C++ standard refers to the term "dynamic type" (and the C standard refers to "effective type" in the similar context), for example

If a program attempts to access the stored value of an object through a glvalue of other than one of the following types the behavior is undefined:

  • the dynamic type of the object,

But how is the dynamic type of the object allocated with malloc determined?

For example:

void *p = malloc(sizeof(int));
int *pi = (int*)p;

Will the dynamic type of the object pointed to by pi be int?

5 Answers
Related