I am deleting a pointer using "delete" in C++.
That pointer is holding the address which is used by OS like 0x00000210.
What will happens?

I am deleting a pointer using "delete" in C++.
That pointer is holding the address which is used by OS like 0x00000210.
What will happens?

You got the problem all wrong. First you can't delete something used by the OS.
Your process has it's own adress space, so adress 0x00000210 is not the fizical memory adress, is just a virutal adress used by your own process, so you can't reference memory locations outside your own adress space.

Most likely if u do something like

int x = 0x00000210;
	void *p = (void*)x;
	
	delete p;

you will end up with an access violation and your program will terminate

Do you mean manually deleting data at an address you chose? Or are you just asking what delete does?

int* x;//declare a pointer to an it
x = new int;//create an int somewhere in memory and store its address in x
*x;//access the actual int stored at the location that x has
delete x;//delete the int stored at the location that x has
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.