C Tutorials

81. Do while Loops in C

By: Kamini : 2007-09-20

Description: The while and for loops test the termination condition at the top. By contrast, the third loop in C, the do-while, tests at the bottom after making each pass through the loop body; the body is always executed at least once.


82. While and For Loops in C

By: Jagan : 2007-09-20

Description: expression is evaluated. If it is non-zero, statement is executed and expression is re-evaluated. This cycle continues until expression becomes zero, at which point execution resumes after statement.


83. switch in C

By: Ivan Lim : 2007-09-20

Description: The switch statement is a multi-way decision that tests whether an expression matches one of a number of constant integer values, and branches accordingly.


84. External Variables and Scope in C

By: Norman Chap : 2007-09-20

Description: The variables in main, such as line, longest, etc., are private or local to main. Because they are declared within main, no other function can have direct access to them. The same is true of the variables in other functions; for example, the variable i in getline is unrelated to the i in copy. Each local variable in a function comes into existence only when the function is called, and disappears when the function is exited. This is why such variables are usually known as automatic variables, following terminology in other languages. We will use the term automatic henceforth to refer to these local variables.


85. Basics of C

By: Abinaya : 2007-09-20

Description: C is a general-purpose programming language. It has been closely associated with the UNIX operating system where it was developed, since both the system and most of the programs that run on it are written in C. The language, however, is not tied to any one operating system or machine; and although it has been called a ``system programming language'' because it is useful for writing compilers and operating systems, it has been used equally well to write major programs in many different domains.


86. Getting Started with C

By: Baski : 2007-09-20

Description: The only way to learn a new programming language is by writing programs in it. The first program to write is the same for all languages:  Print the words, hello, world. This is a big hurdle; to leap over it you have to be able to create the program text somewhere, compile it successfully, load it, run it, and find out where your output went. With these mechanical details mastered, everything else is comparatively easy.


87. Variables and Arithmetic Expressions in C

By: Charles : 2007-09-20

Description: This C sample program uses the formula oC=(5/9)(oF-32) to print the following table of Fahrenheit temperatures and their centigrade or Celsius equivalents:


88. The for statement in C

By: Daniel Malcolm : 2007-09-20

Description: The for statement is a loop, a generalization of the while. If you compare it to the earlier while, its operation should be clear. Within the parentheses, there are three parts, separated by semicolons. The first part, the initialization


89. Symbolic Constants using #define in C

By: Emiley J : 2007-09-20

Description: It's bad practice to bury ``magic numbers'' like 300 and 20 in a program; they convey little information to someone who might have to read the program later, and they are hard to change in a systematic way. One way to deal with magic numbers is to give them meaningful names. A #define line defines a symbolic name or symbolic constant to be a particular string of characters:


90. File Copying in C

By: Fazal : 2007-09-20

Description: Given getchar and putchar, you can write a surprising amount of useful code without knowing anything more about input and output. The simplest example is a program that copies its input to its output one character at a time: