C Tutorials
91. Character Counting sample program in C
By: Grenfel : 2007-09-20
Description: The character counting program accumulates its count in a long variable instead of an int. long integers are at least 32 bits. Although on some machines, int and long are the same size, on others an int is 16 bits, with a maximum value of 32767, and it would take relatively little input to overflow an int counter. The conversion specification %ld tells printf that the corresponding argument is a long integer.
92. Line Counting sample program in C
By: Henry : 2007-09-20
Description: The following C program counts input lines. The standard library ensures that an input text stream appears as a sequence of lines, each terminated by a newline. Hence, counting lines is just counting newlines:
93. Word Counting sample program in C
By: Ivan Lim : 2007-09-20
Description: The following C program counts lines, words, and characters, with the loose definition that a word is any sequence of characters that does not contain a blank, tab or newline. This is a bare-bones version of the UNIX program wc.
94. Arrays sample program in C
By: Jagan : 2007-09-20
Description: This is a sample program to count the number of occurrences of each digit, of white space characters (blank, tab, newline), and of all other characters. This is artificial, but it permits us to illustrate several aspects of C in one program.
95. Functions in C
By: Kamini : 2007-09-20
Description: In C, a function is equivalent to a subroutine or function in Fortran, or a procedure or function in Pascal. A function provides a convenient way to encapsulate some computation, which can then be used without worrying about its implementation. With properly designed functions, it is possible to ignore how a job is done; knowing what is done is sufficient. C makes the sue of functions easy, convinient and efficient; you will often see a short function defined and called only once, just because it clarifies some piece of code.
96. Arguments - Call by Value in C
By: Lakshmi : 2007-09-20
Description: One aspect of C functions may be unfamiliar to programmers who are used to some other languages, particulary Fortran. In C, all function arguments are passed ``by value.'' This means that the called function is given the values of its arguments in temporary variables rather than the originals. This leads to some different properties than are seen with ``call by reference'' languages like Fortran or with var parameters in Pascal, in which the called routine has access to the original argument, not a local copy.
97. Character Arrays in C
By: Manoj Kumar : 2007-09-20
Description: The most common type of array in C is the array of characters. To illustrate the use of character arrays and functions to manipulate them, let's write a program that reads a set of text lines and prints the longest. The outline is simple enough:
98. Data Types and Sizes in C
By: Priya : 2007-09-20
Description: There are only a few basic data types in C: char, int, float, double.
99. Constants and escape sequences in C
By: Reema sen : 2007-09-20
Description: An integer constant like 1234 is an int. A long constant is written with a terminal l (ell) or L, as in 123456789L; an integer constant too big to fit into an int will also be taken as a long. Unsigned constants are written with a terminal u or U, and the suffix ul or UL indicates unsigned long.
100. Declarations in C
By: Sam Chen : 2007-09-20
Description: All variables must be declared before use, although certain declarations can be made implicitly by content. A declaration specifies a type, and contains a list of one or more variables of that type, as in int lower, upper, step;