Command-line Arguments in C
In environments that support C, there is a way to pass command-line arguments or parameters to a program when it begins executing. When main is called, it is called with two argume
Read tutorialTHE TUTORIAL LIBRARY
In environments that support C, there is a way to pass command-line arguments or parameters to a program when it begins executing. When main is called, it is called with two argume
Read tutorialNewcomers to C are sometimes confused about the difference between a two-dimensional array and an array of pointers. int a[10][20]; vs int *b[10];
Read tutorialConsider the problem of writing a function month_name(n), which returns a pointer to a character string containing the name of the n-th month. This is an ideal application for an i
Read tutorialC provides rectangular multi-dimensional arrays, although in practice they are much less used than arrays of pointers. In this section, we will show some of their properties.
Read tutorialSince pointers are variables themselves, they can be stored in arrays just as other variables can. Let us illustrate by writing a program that will sort a set of text lines into al
Read tutorialA string constant, written as "I am a string" is an array of characters. In the internal representation, the array is terminated with the null character '\0' so that programs can f
Read tutorialIf p is a pointer to some element of an array, then p++ increments p to point to the next element, and p+=i increments it to point i elements beyond where it currently does. These
Read tutorialIn C, there is a strong relationship between pointers and arrays, strong enough that pointers and arrays should be discussed simultaneously. Any operation that can be achieved by a
Read tutorialSince C passes arguments to functions by value, there is no direct way for the called function to alter a variable in the calling function. For instance, a sorting routine might ex
Read tutorialIt is possible to control preprocessing itself with conditional statements that are evaluated during preprocessing. This provides a way to include code selectively, depending on th
Read tutorialA definition has the form #define name replacement text
Read tutorialFile inclusion makes it easy to handle collections of #defines and declarations (among other things). Any source line of the form #include "filename"
Read tutorialOne example today. A better developer tomorrow.