delete float value.

EDIT: "original" poster was LethaboNdlovu. Who seems to have vanished.


FWIW:
Just delete every line with a "delete" in.
Can't see why you are trying to destroy them anyway: they aren't being unkind to you.
Last edited on
1) Please use code tags when posting code, to make it readable:

http://www.cplusplus.com/articles/z13hAqkS/

2)
Am interested in deleting the float values from the code.

You can't. You've declared those variables as local variables, which means they have automatic storage. This means that the compiler will manage their lifetime; you can't manually delete them yourself.

If you want to manually manage the lifetime of those variables, you'll need to declare them as pointers, and dynamically allocate the memory for them using new. But that's something you should only do if you have good reason to do it; as your code stands now, using local variables is the right thing to do.

3) What on earth is the point of a loop that only executes once?

for(int i = 0; i < 1 ; ++i)
Am interested in deleting the float values from the code.
What exactly does 'deleting the float values' mean? Setting them to 0 perhaps?
Am interested in deleting the float values from the code. Can some one help me do so?

Two things:

1.
PLEASE learn to use code tags, they make reading and commenting on source code MUCH easier.

http://www.cplusplus.com/articles/jEywvCM9/
http://www.cplusplus.com/articles/z13hAqkS/

HINT: you can edit your post and add code tags.

Some formatting & indentation would not hurt either

2. You can't delete the values, as everyone has already told you.

Even if you could delete the values you try to delete them and then right afterwards you print out the values. At "best" that is undefined behavior. At worst it could crash the program.
At "best" that is undefined behavior. At worst it could crash the program.

Isn't a crash better than UB ?
This post gives me deja vu.

Edit: Yeah, it's here
https://www.cplusplus.com/forum/beginner/280351/

LethaboNdlovu, explain yourself.

Edit: OP's first post was a copy, too. Goodbye.
Last edited on
Topic archived. No new replies allowed.