error trying to #include headerfile within main function

Newbie question: To my knowledge the way #include works is that it copy-pastes whatever is inside the included file to the designated spot. All I want is to #include a file which only holds a printf().

And while this works perfectly in any online IDE i have tried, in Code::Blocks I receive

error: expected declaration specifiers or '...' before string constant

This is the main file:

#include <stdio.h>

int main(void)
    #include "null.h"

And this is the included null.h:

printf("Hello, world\n");

I have tried #include <stdio.h> above printf aswell as calling the file null.c however nothing seems to work. I have searched Google but can't wrap my head around what this error has to do with any of the explanations provided.

Read more here:

Content Attribution

This content was originally published by mculaid at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: