Lecture 2 – Elements of C Language
Control Structures Control Structures are the structures which control the flow of the program in any programming language. There are three basic control structures in any programming language. Sequence or Statements Selection or Decisions Iteration or Loops Sequence or Statements These structures are responsible for the linear flow of the program. Following are the types of Sequence Structures Input – these statements are responsible for taking input from the user. For example scanf, gets, getch, getche etc. Output – these statements are responsible for giving output to the user. For example printf, puts etc. Expressions – these statements constitutes of program logic. For example y = mx +c; or c= a+ b; etc. Selection or Decisions There are some situations where we have to take decision based upon some condition. These structures are used to transfer the control of your program based upon a condition. For example if you ...