Review the C language Parsing tutorial (i)

Source: Internet
Author: User

Recently went to the library to learn C language books, feel by < Mei >al Kelley and Ira Pohl-Mazhi translation of the "C Language Analysis Tutorial" translated very good, especially the C language learning method (of course, I still compare the suggestion to learn the two languages and then do a good tour), In the process of learning C language, interspersed with c++!

In the C language of the road, I still want to work hard is!

1. Programs that do not contain header files can also be run!

int Main () {    int a=3, b=4;     return 0 ;}

2. If a and B are variables of type int, where one or two are negative, the value of A/b is system-dependent and is determined by the system.

Variables of type 3.float are usually added to the right of the assignment statement with F.

A constant of 4.long double is added to L.

5. When the constant is a double type, the variable is of type float, so there is no problem.

Note: Floating-point types can be freely mixed in expressions and assignments.

    float  x, y;    X=1.0// Note: This sentence and the following sentence are missing F    y=2.0;

6. The Division of floating-point numbers is the same as people's imagination, according to normal division.

Example: 7.0/2.0=3.5

7. In a floating-point expression, 0 is not allowed to divide, otherwise a value that is not a number may be generated.

Note: This can be run in dev, displaying values that are not numbers, which, under vc++6.0, will give an error and the executable program cannot be generated.

header files such as stdio.h in a 8.UNIX system are typically in/user/include

9. #define can appear anywhere in the program, affecting only those rows that follow it in the file.

Note: Usually after # include, the changed identifiers are written in uppercase

10. Formatting control in the printf () function

Floating point number of%e scientific counting method

%g in E-format or F-format, takes a shorter one

11. The address of a variable is the address stored in the variable memory. (Here's a question: What's the difference between this memory and storage?) )

12.SCANF () function format control character

LF stands for double

LF represents a long double

13. In the traditional C language, long float is synonymous with float, but in Ansic C, there is no long float.

Note: Do not consider this article now, understand can.

14.

 while (scanf ("%f", &x) = =1);

Indicates that if successful, convert the user input character to float type to save X, success is true, failure returns 0, no re-use return-1

In 15.UnIx, a carriage return followed by Ctrl+d is a typical end-of-file flag.

16. Note: In an interactive environment, it is not an error for a program to use a dead loop!

17. In Unix, common CTRL + C interrupts the program.

In 18.UNIX, the command ls>temp is to write the contents of the previous output to the screen to a file, which is referred to as redirection.

C++

The 1.c++ I/O library is iostream.h

2.

count<<"hello,world! "<<endl;

Count represents the screen

<< is putting a string into the output stream

Endl for refreshing output and moving to a new line

In the 3.c++ program, return 0 can be ignored;

Note: This statement is inserted because of its implication.

4. Greatest common Divisor

 while (n!=0)    {        R=m%N;        M=N;        n=r;    }     // the final output of M is greatest common divisor

5.cin is usually the standard input stream associated with the keyboard.

cin>>m>>n;

6. Note:

1 Finder = 6 feet

1 feet = 12 inches

1 yards = 36 inches

Review the C language Parsing tutorial (i)

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.