Addition of basic tutorials for C language beginners

  • 2020-05-30 20:51:04
  • OfStack

Write the program first:


#include <stdio.h>

int main()
{
  int a = 1;
  int b = 2;
  int c = a + b;
  printf("sum is %d\n", c);
  
  return 0;
}

Operation results:

sum is 3

Program analysis:

Define an integer variable, a, and assign 1 to a.
Define another integer variable, b, and assign 2 to b.
Finally, we define an integer variable c, whose value is not assigned by assignment, but assigned to it after adding a and b, that is, the value of c is 3.


Related articles: