Does an equivelent to C++’s placement new exist in C? I mean, can an object be constructed at a specified location in C? Can realloc() be used for that?
Does an equivelent to C++’s placement new exist in C? I mean, can an
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no such thing as “placement new” in C. On the other hand, you can declare a pointer and make it point to anything in memory:
The above pointer now points to whatever is as the address
0x12345678.This is often used in embedded systems, where certain devices are at certain places in memory.