Search code examples
cincludestdio

What does '#include <stdio.h>' really do in a C program


I am new to C programming, and as I was coding some simple 'Hello World' style programs, I noticed that in all of them, I included #include<stdio.h> at the top.

However, I'm not sure what this means exactly. I tried searching online and found that stdio.h is a file containing commands for the preprocessor, but what is a preprocessor? I thought that when I write code, I compile it, and my code transforms into a form that a computer can read, and then I can run it. Can someone explain to me the usage of this command?"


Solution

  • It looks for the stdio.h file and effectively copy-pastes it in the place of this #include statements. This file contains so-called function prototypes of functions such as printf(), scanf(), ... so that compiler knows what are their parameters and return values.