Suppose i create a new float;
float *pointer = new float;
now i delete this pointer.
delete pointer;
Now can i create a new float at the same memory location the pointer was pointing to ?
float *pointer1 = new float;
Suppose i create a new float;
float *pointer = new float;
now i delete this pointer.
delete pointer;
Now can i create a new float at the same memory location the pointer was pointing to ?
float *pointer1 = new float;
Is it possible to create a variable at an assigned address location
No. The language implementation is responsible for choosing the address of all variables.
It is possible to create a dynamic object at an address, as long as that address satisfies certain preconditions. In particular, the memory has to be allocated, it must not be used by any non-trivial object, and the address must satisfy the alignment of the type. The syntax for creating an object at an address is called placement-new.
now i delete this pointer.
Now can i create a new float at the same memory location the pointer was pointing to ?
You have deallocated the memory, so you may not create an object there.
There is no standard way to allocate a specific address, and if the address is something that may be returned by by the global allocator, then allocating such address using system specific means would probably break the global allocator.
TL;DR You cannot do that explicitly. However if you do new float
immediately after that deletion, then it is possible and in some cases likely that you get the same address.