Start learning C today

Today I learned what is the C language. I
simply learned printf, sizeof, and simple addition operations. The
following is a brief summary of the notes:

  1. Floating point (decimal)
  2. char character data type (1)
  3. short (2)
  4. int shaping (4)
  5. long (4/8)
  6. longlong Longer plastic surgery (8)
  7. float single-precision floating-point number(4)
  8. double double-precision floating-point number (8)
  9. %c print character format data (single quotation mark)
  10. %d print integer decimal data (without sign)
  11. %f print floating point data
  12. %p is printed as an address
  13. bit
  14. byte byte one byte section eight bits
  15. kb one kb 1024 bytes
  16. mb
  17. gb
  18. tb
  19. pb
  20. Variable representation type + variable name + value // int age=20;
  21. Global variables are defined outside the code block. Local variables, defined in the code block
  22. The suggested names of local variables and global variables are different, which is easy to misunderstand and cause bugs. If they are the same, the local variables are output first. But the domain of global variables is larger than the domain of local variables in the whole project.
  23. scanf input function (use scanf_s when the return fails)
  24. & Take address symbol
  25. C language stipulates that variables should be defined at the top of the current code block and
    have their own practice and review
    #include <stdio.h>
    int main()
    {
    int num1 = 0;
    int num2 = 0;
    int sum = 0;
    scanf_s( "%d%d", &num1, &num2);
    sum = num1 * num2;
    printf("sum=%d\n", sum);
    return 0;

}
#include <stdio.h>
int main()
{
printf("%d\n", sizeof(char));
printf("%d\n", sizeof(short));
printf("%d\n", sizeof(int));
printf("%d\n", sizeof(long));
printf("%d\n", sizeof(long long));
printf("%d\n", sizeof(float));
printf("%d\n", sizeof(double));
return 0;
}

Guess you like

Origin blog.51cto.com/15081180/2590469