User User - 4 months ago 49
C Question

How to set a particular byte in a file to 0 or 1?

I have a

to where I want to set the byte, from malloc. How do I set it to 1 or 0, for example?


Assign to your dereferenced pointer:

//This will (obviously) set it to 1
*your_pointer = 1;

//This will set it to 0
*your_pointer = 0;