@Debojit Acharjee Try reading the answers for content. No one said the definition did not initialize the value to the pointer. It is your assertion that the value was stored in the object pointed to is being rejected.
Your knowledge is only half correct. All objects store values. The nature of the values and how they are used depends on the type of the object. int and double hold normal arithmetic values. char holds a character but can also handle small integers. An object of pointer type holds the address of another object. A pointer to void can hold the address of any type of object. Any other pointer to any other type can only hold the address of an object of that type.
The dereference operator when applied to a pointer in an expression tells the compiler to access the the object the pointer points to. The asterisk used in a definition or in the cast operator is NOT a dereference operator. It is the syntax that indicates a pointer type is being derived. In these two lines
int *ptr;
ptr = (int*)malloc(100);
neither asterisk is a dereference operator. It is simply syntax identifying that ptr is a pointer to int, not an int, and kthe value returned by malloc should be converted to a pointer value, not an int value.
In the following line
*ptr = 10;
the asterisk is a dereference operator. It says don not assign the value to ptr but to the object ptr points to.
And the cast operator in the call to malloc above is NOT required in C. It is optional and basically superfluous. In C, there is an implicit conversion defined for pointer-to-void to any other object pointer type and also in the reverse direction. This is not true in C++ which also discussed in this group. Do not confuse the two languages.