Introduction to Chapter I.

Source: Internet
Author: User

  1. The character type is actually the int type, and the way to save it is to put the ASCII code of the character. The char type is actually a short type.
  2. The single quotation mark includes a character, and the double quotation mark includes a string.
  3. Dividing the number of shaping numbers, this operation will perform the rounding, for example: 5/9, should be approximately equal to 0.5555, but due to the bit, the final value is 0. If you need to preserve the decimal place, first convert the operand to a floating-point number, for example: 5.0/9.0.
  4. The string is stored as a character array. Example: Char strings[20].
  5. GetChar, sanf, are read data from the input buffer. If the buffer has data remaining, calling these functions again does not wait for the user to input, but instead takes the data directly from the buffer.
  6. scanf ("%c%c", &var1,&var2), the first string is entered after the input of an invisible character (tab, space, carriage return) can be entered as the first string of flags.
  7. Determines whether the input character is a number, for example, C is the character entered by the keyboard
    ' 0 ' ' 9 '//compare numbers with single quotes to character type

    Because C saves the ASCII code of the input character, the value of 0~9 in the ASCII code is not 0~9, but 48~57. Therefore, the value of the comparison also needs to be converted into a character type. This can be one by one on the corresponding.

  8. The starting position of program execution for C language starts with the main function.
    The main function itself is also a function, so it can also return a value to its callers.
    The caller of the main function is actually the execution environment of the program.
    A return value of 0 indicates that the program terminated normally, and not 0, indicating an exception condition or an error end.
  9. Function prototypes
    Tells the compiler what parameters a function will accept, what return value will be returned, and the > Sample compiler will be able to check that the call to the function is correct and that there is an incorrect type conversion. For example, the following function prototypes;
    int some_func (int,char•,long);

    The compiler checks that all references to the function, including the function's definition, use three parameters > and returns a value of type int. If the compiler discovers that a function's call or definition does not match the function prototype, the compiler reports an error or warning message

  10. function parameters
    The function parameter is passed by value. Parameters can be thought of as function internal variables that are easy to initialize.
    If the parameter needs to be passed by reference, the pointer needs to be passed to the argument, and the argument must be declared as a pointer type.
    When a parameter is an array, the value passed to the function is the position or address of the starting element of the array-it does not copy the array element itself.

Introduction to Chapter 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.