Your microcontroller might have some EEPROM, OTP memory, user fuse bits, where you can set a flag.
There is no "best method in embedded C", writing nonvolatile memory is different in every microcontroller.
Flash memory contents are erased while programming the device. After programming, all bytes that weren't written contain 0xFF. Consult the datasheet to find an area that can be safely programmed from within the running firmware.
Although it's not guaranteed in the datasheets, all EEPROMs I've seen so far contained 0xFF:s when shipped from the factory (except ones preprogrammed with an unique MAC address, but that's explicitly documented). Some programming devices/software are able to erase or program EEPROM contents too. Some can be write protected, permanently or reversibly.
One Time Programmable memory always contains well defined initial values, documented in the datasheet.
It's always a good idea to include a good checksum like CRC32 with the data written, to protect against data corruption caused by defective parts, transmission errors, cosmic rays, whatever.