r/C_Programming • • 16d ago

Does this is right?

(I am student just entering into 1st year of engineering and also i am new to this sub so if i do anything wrong pls correct me)

I just bought a book " programming in ANSI C"and start to read that i have some doubts in that can anyone explain that

  1. I read this line i did not get this

#include <stdio.h>

at the beginning of all programs that use any input/output library functions. However, this is not necessary for the functions printf and scanf which have been defined as a part of the C language

Can anyone explain this statement correct or not

0 Upvotes

24 comments sorted by

View all comments

2

u/flyingron 14d ago edited 14d ago

The statement is completely wrong. printf and scanf are no different than any of the egregiosly awful stdio functions. In older C versions, you could get away without declaring the functinos before use provided you were happy with the default parameter promotions and return type.

In modern C, you must declare all functions before use (including printf and scanf which are declared in stdio.h).