error: 'endl' was not declared in this scope

The error message "'endl' was not declared in this scope" typically occurs when the endl manipulator is used without including the necessary header file. To resolve this error, you need to include the <iostream> header file in your C program.

Here is an example of how you can fix this error:

#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

By including the <iostream> header file, you are ensuring that the necessary declarations for the endl manipulator are available in your program.