#ifndef MY_HEADER_H // Check if MY_HEADER_H is not defined #define MY_HEADER_H // Define MY_HEADER_H 2. Preventing Code Duplication in the Preprocessed Output When you copy or include a file multiple times in a program, the preprocessor simply expands the file contents. To avoid multiple definitions:
Use header guards or #pragma once in headers. Declare functions in headers (.h) and define them in source files (.c). Use extern for global variables to avoid duplication. #ifndef MYHEADER_H #define MYHEADER_H
The function is declared in the header but defined only once in , preventing multiple definitions.