Archive for C Fundamentals

You are browsing the archives of C Fundamentals.

C Graphics

In a C Program first of all you need to initialize the graphics drivers on the computer. This is done using the initgraph method provided in graphics.h library.
Graphics mode Initialization
initgraph() function is used to load the graphics drivers and initialize the graphics system. For every function, that uses graphics mode, graphics mode must be initialized [...]

C File Handling

A file is a collection of bytes stored on a secondary storage device, which is generally a disk of some kind. The collection of bytes may be interpreted, for example, as characetrs, words, lines, paragraphs and pages from a textual document; fields and records belonging to a database; or pixels from a graphical image. [...]

C Structures and Unions

A structure is a collection of variables under a single name. These variables can be of different types, and each has a name which is used to select it from the structure. A structure is a convenient way of grouping several pieces of related information together.
Declaring Structures

struct mystruct
{
int numb;
[...]

C Strings

Character type array is called string. All strings end with the NULL character. Use the %s placeholder in the printf() function to display string values.
Declaration:
char name[50];
Example

#include <stdio.h>
void main (void )
{
char *st1 = "abcd";
char st2[] = "efgh";
printf( "%s\n", s1);
[...]

C Arrays

An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.
An array is a data structure of multiple elements with the same data type. Array elements are accessed using subscript. The valid range of subscript is 0 [...]

C Pointers

A pointer is a variable suitable for keeping memory addresses of other variables; the values you assign to a pointer are memory addresses of other variables or other pointers.
C pointers are characterized by their value and data-type. The value is the address of the memory location the pointer points to, the type determines how the [...]

C Functions

Function is a block of statements which perform some specific task and always return single value to the calling function. Functions are used to minimize the repetition of code.
Some languages distinguish between functions which return variables and those which don’t. C assumes that every function will return a value. If the programmer wants a [...]

C Loops

Loops are used to repeat one statement or set statements more than one time. Most real programs contain some construct that loops within the program, performing repetitive actions on a stream of data or a region of memory. There are several ways to loop in C.
For Loop
For loop is a counter loop. The for loop [...]