If you're planning on using those methods in C++, be careful not to overwrite protected regions of classes (like v-tables). The methods may also not have the expected effect on floating point values. (You might also consider placing those warnings in the relevant documentation to your end-users.)
oh this is not for end users. I am a novice programmer and just practicing.
Do you know the answer for this...
...Also, because char* is being used, will it work for any 1 byte section of memory, no matter what is stored at that address?
So far I have had luck with double and floats. I have tried different numbers with decimal places and get correct results. As long as I enter the correct size_t for the datatype I am using.
It should be noted that the functions defined from line 16 onwards and the functions declared between lines 10-12 are not the same.
Also, because char* is being used, will it work for any 1 byte section of memory, no matter what is stored at that address?
For some definitions of "work", yes. For example, if by "work" you mean "replace the contents with something that won't make the program crash at some point", then no, it won't "work" for every valid input ("valid" meaning a set of parameters that reference memory that the program is allowed to modify).
I'm just curious, I know you said you were a novice but you seem to have some skill in the subject, why is this written in C? The whole taking void pointers as arguments and explicitly casting them within the next couple of lines is pretty old school, with a handful of changes you could use templates.
@helios
I thought that was how it needed to be setup. But now that you have pointed it out, I understand why I do not need the class. Thanks.
@computergeek01
templates are going to be next . When I was researching this, as pointed in the hyperlink, I practically copied the memcpy function, and based my others off of that (that isn't to say that I do not understand it). The original source is written in C.