Archive for C Introduction

You are browsing the archives of C Introduction.

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 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 [...]

C Control Structure

C language possesses such decision making capabilities and supports the following
statements known as control or decision-making statements.
if statement
switch statement
Conditional operator statement
goto statement
if Statement
The if statement is a powerful decision making statement and is used to control
the flow of execution of statements. It is basically a two-way decision statement
and is used in conjunction with an [...]

C Keywords

Keywords:
A keyword is a word that is part of C Language itself. These words have predefined meanings and these words cannot be used as variable names.

C Keywords

char
signed
break [...]

C Variables

C has the following simple data types:

C type
Size (bytes)
Lower bound
Upper bound

Char
1
—–
——

Unsigned char
1
0
[...]

First Program

Here is your first c program. Write carefully because C Language is a case sensative language.

#include < stdio.h>
void main()
 
{
printf("Hello World\n");
}

Press ALT+F9 to compile your program. If you have any error in your program, you will get the message, remove your errors and then execute your program you will got the out [...]