This tutorial covers many topics in VGA programming in the C programming language. Tutorial assumes that the programmers have a comprehensive understanding of C and should also have a familiarity with DOS and BIOS function calls and interrupts. Knowledge of trigonometry and geometry would also be helpful.
A union in C programming is a user defined data type which may hold members of different sizes and type. Union uses a single memory location to hold more than one variables. However, only one of its members can be accessed at a time and all other members will contain garbage values. A structure is a convenient tool for handling a group of logically related data items. Structure help to organize complex data is a more meaningful way. It is powerful concept that we may after need to use in our program Design.
C language provides a standard and minimal set of basic data types. Sometimes these are called primitive data types. More complex data structures can be built up from these basic data types. Data types specify how we enter data into our C programs and what type of data we use for different operations. C has some predefined set of data types to handle various kinds of data that we can use in our program.
File stores information for many purposes and retrieve whenever required by our programs. A file represents a sequence of bytes on the disk where a group of related data is stored. File is created for permanent storage of data.
In a C program, first step is to initialize the graphics drivers on the computer. This is done using the initgraph() method provided in graphics.h library. In the next few pages we will discuss graphics.h library in more details. Important functions in graphic.h library will be discussed in details and samples programs will be provided to show the power of C programming language especially for graphic programming developing graphical user interfaces.
A pointer is a variable that represents the location of a data item, such as a variable or an array element. Pointers are used frequently in C, as they have a number of useful applications. For example, pointers can be used to pass information back and forth between a function and its reference point. Pointers provide a way to return multiple data items from a function via function arguments to
be specified as arguments to a given function.
A function is a block of code that has a name and it has a property that it is reusable i.e. it can be executed from as many different points in a C Program as required. Function groups a number of program statements into a unit and gives it a name. This unit can be invoked from other parts of a program. A computer program cannot handle all the tasks by it self. Instead its requests other program like entities – called functions in C – to get its tasks done. A function is a self contained block of statements that perform a coherent task of same kind.
C programs are executed in a sequence, but we can control the execution of program by using any control mechanism by which we can compare things and come to a decision. This involves using some operations called Relational Operators, conditional statements called if-else and loops. We have fundamental operators to compare two values.