C\c++ Header File Description

Source: Internet
Author: User

C\c++ programming time often encounter header file problems and a series of debugging errors, below I briefly give an example of the role of the header file, we know a c\c++

The beginning of the program is generally:

#include <iostream.h>

#include <fstream.h>

#include <stdlib.h>

1. First: iostream.h

is the standard input-output stream header file

Contains cin>> to enter.

cout<< to output.

These two methods of input and output

A #include<iostrem.h> is required to declare the header file.

What's more: the C + + program uses

#include is a command that copies the contents of the Iostream.h file to this place.

The ostream.h is a shorthand for the input output stream, meaning the standard inputs and outputs stream header file. It contains:

(1) cin>> "What to enter"

(2) cout<< "What to Output"

These two methods of input and output require #include<iostream.h> to declare the header file.

Iostream.h and iostream are different.

#include <iostream.h> is used in the old standard C + +. In the new standard, use #include<iostream>. Iostream means the input and output stream. #include <iostream> is a standard C + + header file, and any standard C + + development environment has this header file.

2. The same can be understood for fstream.h:

It is the header file of the input/output library function of the file

#include <iostream>

FStream inherit iostream; FStream has iostream functionality, but does not include relationships.

FStream is a file operation and iostream is an operation on a standard input and output file.

3. The same can be understood stdlib.h

Stdlib header file is standard library header file Stdlib header file contains the C, C + + language of the most commonly used system functions The file contains the C language standard library function definition stdlib.h inside defines five types, some macros and common tool functions. Types such as size_t, wchar_t, div_t, ldiv_t, and lldiv_t, macros such as Exit_failure, Exit_success, Rand_max, and Mb_cur_max, etc., commonly used functions such as malloc (), Calloc (), realloc (), free (), System (), Atoi (), ATOL (), Rand (), Srand (), exit (), and so on. Specific content you can open the compiler's include directory inside the stdlib.h header file to see. Popular is that your specific program is useful to each function of the function or statement, must have a header file to be pre-explained before compiling. This is why the first part of the program to explain the role of the header file.

C\c++ Header File Description

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.