ProgIntro

Introduction to programming

Following suggestions can help you in learning the science and art of programming:

  1. Writing your programs by hand on a piece of paper may sound like an outdated practice but it is very important especially for beginners. Being able to write a correct program on a paper is more important because our examination system currently allows taking exams on papers, not on computer.

  2. It is equally important to be able to type the program on computer and check if it works. Many skills such as typing, indentation, debugging etc can only be learned by typing your program on computer.

  3. Although you can type your program online by visiting online c compilers using your smartphone, I would advise you not to do so.

  4. Install the recommended software on your own computer.

  5. Practice is the key, which means repeat, many students take pictures of the white board instead of taking notes, this is the modern trend but believe me when I say it will not help you in learning.

  6. Just as writing code is a skill you will learn over time, reading code whether it is written by you or by your teacher is another skill. Many students cannot correctly compile a program because they could not read what the instructor wrote on the whiteboard e.g. when the instructor wrote semicolon ; you for some reason read comma ,

  7. When your program does not compile it will tell you in shape of warning or errors. Try to learn which type of errors are related to what kind of problems. e.g. “11. Statement missing ;” is telling you that you forgot to type a ; near line number 10 or 11.

Introduction to C programming language

Few basic but important things to keep in mind:

Reserved words / Keywords

auto break case char
const continue default do
double else enum extern
float for goto if
int long register return
short signed sizeof static
struct switch typedef union
unsigned void volatile while

Basic use of keyword-

  1. int, float, char, double, long, short – These are the data types. Each data type has a different meaning.
  2. if, else, switch, case, default – These are the types of control statements.
  3. for, while, do – These are the types of loops.
  4. return – used for returning a value.
  5. void – One of the return type.
  6. auto, extern, const, extern, register, signed, unsigned – These are used to defines variables.
  7. break, continue – This keyword is used with a loop.
  8. goto – Used for redirecting the flow of execution.
  9. enum – It is a data type which contains set of constants.
  10. sizeof – sizeof keyword is used to know the size.
  11. struct, typeof – keywords used in the structure.
  12. union – It is a collation of variables.