first you need to narrow the DAC that you are going to use.. sadly there's a ton of i2c devices, and even with a common bus, each device is configured differently.
let's take in example that you'll use a
https://wiki.dfrobot.com/Gravity__12-Bit_I2C_DAC_Module_SKU__DFR0552 it uses a MCP4725 so you should start checking the datasheet of that chip.
any way, that wiki should address most common questions regarding initialization and some examples for raspberry (even the arduino ones, can be used as foundation for a C implementation)
to only one consideration I would have in mind, is that i2c is slow... the base 100kHz frequency (or 10 us per bit) will require at least 270 us to transmit 3 bytes (1 i2c address, 2 data bytes) so you can achieve a max sampling frequency of 3.7 kHz.