Constant variable Assignment c

Source: Internet
Author: User

  1. Constants :
  2. Constants represent some fixed data, 0.0 is decimals, 0 is 0, floating-point type plus f;1.2f is single-precision floating point, 1.2 is double precision;
  3. The string is double-quoted, and the character is enclosed by single quotation marks;
  4. variables :
  5. Represents a variable data;
  6. How to define variables: variable type + variable name; As long as you define these, you will have storage space in memory;
  7. int score; The variable name is also one of the identifiers;
  8. As long as you define this variable, there will be a unique storage space for it;
  9. Different types have different sizes; The purpose of the write type is to constrain the size of the variable;
  10. Integer data 4 bytes; char type 1 bytes;
  11. Assignment Value :
  12. score = 1000; assignment operation; assignment operator; right to left; Char denotes character;
  13. each assignment will overwrite the previous value; The first assignment represents initialization; int a = 20;
  14. Variables can be defined consecutively; int d,e,f;
  15. b = A = 40; first give 40 a, then the value of a is assigned to B;
  16. printf ("Score is%d\n", score); %d is a format character; a placeholder;%d is used to occupy a position; the future is for score;%d can only be used to output integers;
  17. %f accuracy of the output,%f used to output decimals, default is 6 bits,%c means char type,%d and%i are the same, can represent integer type ;
  18. printf ("/score is%d\n", "", "", Score,height,socregrade);
  19. Summarize:
  20. Variable type and variable name, assignment of variable, output of variable; printf ("%d\n", a)
  21. The scope of the variable in the function:
  22. Variable is used with a scope
  23. The storage space of main is not fixed;
  24. A function is a large block of code, which can have small blocks of code;
  25. The code block is the place to constrain the code, and the code nearest to the scope is the principle;
  26. The code inside the code block only works within the code block, but if it is not implemented within the code block, it will jump to the nearest block of code;
  27. Blocks of code can improve performance;
  28. The compiler for the Mac computer is 64 bits, the corresponding data type byte number is: char 1 bytes; int 4 bytes; float 4 bytes; double 8 bytes;
  29. The variable starts with the line defined, functions to the end of the code block, and the code block can reclaim memory and improve performance in time;

Constant variable Assignment c

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.