Auch in C kann man das Factory Pattern umsetzen, meist über Funktionszeiger und Structs:
typedef struct Sensor { void (*read)(struct Sensor* self);
} Sensor;
void i2c_read(Sensor* self) { /* I2C read */ }
void spi_read(Sensor* self) { /* SPI read */ }
Sensor create_sensor(const char* type) {
Sensor s;
if (strcmp(type, "I2C") == 0) s.read = i2c_read;
else if (strcmp(type, "SPI") == 0) s.read = spi_read;
return s;
}