# WHY: Why should we use header files?
In C++ Basic - 01 Function
, we have learned about function. But there are numerous which have been already written, like print function printf()
:
int printf (const char *__format, ...){
int __retval;
__builtin_va_list __local_argv; __builtin_va_start( __local_argv, __format );
__retval = __mingw_vfprintf( stdout, __format, __local_argv );
__builtin_va_end( __local_argv );
return __retval;
}
The function of function is output or print something. This is only the main part of the function, and the function involves a huge amount of APIs and parameters.
Thus, if we write the function by ourselves, it would be extremely inefficient. So C++ or C has written for us already, and the only thing we are supposed to do is using header files.