In this section we have given large number of tutorials on C programming
Language. C programming language is used to develop applications mostly for
Linux environment. But is it not limited to only Linux environment. You can
compile the C program for any platform and then run.
C is one of the most used programming Language for developing applications.
To test the examples you will be needing a C compiler on your machine.
Here are the tutorials of C programming language.
- C Array copy example
The example below contains two arrays: array1 and
array2 with sizes 5 respectively. Here the size of an array states its
capacity to hold maximum number of values.
To declare an array in C, you have to specify the name of the data type and
the number of elements inside the square brackets.
- C Array default values
The example below contains an array arr of integer
type. The maximum size of the array is 4.
- C Array length example
An array is a contiguous group of data items with the same name and data
type. In order to get the length of an array, we have used the sizeof operator.
- C array of pointers
A pointer is a variable that contains the memory location of another
variable. The values you assign to the pointers are memory addresses of other
variables (or other pointers).
- C array sort example
For sorting an array, we have used the qsort function. This function provides the
implementation of quicksort algorithm to sort the elements of an array .
- C String length
In this section, you will learn how to determine the length of a String in C. You
can see in the given example, we have declared a string and initialize a
variable i to 0.
- C Break with Switch statement
The switch case statements allows to control complex
conditional and branching operations. It include any number of case
instances, but should not have the same value.
- C Break for loop
The break statement terminates the execution of the enclosing
loop or conditional statement. In a for loop statement, the break
statement can stop the counting when a given condition becomes true.
- C break continue example
The continue statement provides a convenient way to force an
immediate jump to the loop control statement. The break statement terminates the
execution of the loop.
- Array of String using Pointers
The declaration of an array of character pointers is an extremely useful
extension to single string pointer declarations. In the example below, A two element array of character pointers where each element is a pointer to a
- C Array of String
A String is an array of
char objects. An array of string can be declared and handled like a 2d(two
dimensional) arrays. You can see
in the given example that we have declare a 2 dimensional character array
consisting of three 'rows' and twelve 'columns'.
- C String to Int
In this section, you will learn how to convert a string
represented value into an integer represented value in C.
- C define Macro
Macros are the identifiers that represent statements or expressions. To
associate meaningful identifiers with constants, keywords, and statements or
expressions, #define directive is used.
- C Current Time
The header file <time.h> provides all date and time functions. In
the given example, the time() function determines the current time in
seconds and assigns it to time_t type variable t.
- C String Remove Spaces
In this section, you will study how to remove spaces from the string. You can
see in the given example, we have define the string and passed it into two
- C Pointer to a function
C provides a special feature of pointer to a
function. As you know that every function defined in C language have a
base address attached to it.
- C Multiple Indirection
C permits the pointer to point to another pointer.
This creates many layers of pointer and therefore called as multiple
indirection. A pointer to a pointer has declaration is similar to
that of a normal pointer but have more asterisk sign before them.
- C Goto Statement
The goto statement is a jump statement which jumps from one point to another
point within a function. The goto statement is marked by label statement.
- C GMT Time
In this section, you will study how to get the gmt time in C.
GMT stands for
Greenwich Mean Time. In the given example, the time() function determines
the current time in seconds and assign it to t.
- C file write example
Here we are using the library function fwrite() to write the
data into the file. You can see in the given example, we have stored the string
into the buffer which is to be written into the specified file 'Hello.txt'.
- C file rename
This section illustrates you to rename a file in C. You can see in the given
example that we want to replace the name of the text file MYFILE.txt with
- C file read example
This section demonstrates you to read a line from the file. You can see in
the given example, we prompt the user to enter the name of the file to read.
- C file open example
The header file <stdio.h> provides several functions related to file
operations. Here we are going to open a file using library function fopen(). You
can see in the given example, we have used the type FILE in order to store the
information related to file stream.
- C file Last Modified Date
You can see in the given example that we want to get the last modified date
of the specified file Hello.txt. For this, we have defined the library
function strftime() provided by the header file <time.h>
that formats the time represented in the structure according to the formatting
rules defined in format and stored into t.
- C file delete example
This section illustrates you to delete a file in C. You can see in the given
example that we want to remove the file HELLO.txt. For this, we have used
the library function remove() which deletes the file HELLO.txt.
- C Dynamic Array
The dynamic array is an array data structure which
can be resized during runtime which means elements can be added and
removed. You can see in the given example that we prompt the
user to enter the number of elements that he want to set into the
- C String Copy
In this section, you will learn how to copy the string in C. You can see in
the given example, two string variables st1 and st2 are created. A string is
passed to the st1.
- C String Concatenation
In this section you will study how to concatenate the two strings in C. You
can see in the given example, we have declared two strings in order to combine
- C String Compare
In this section, you will learn how to compare two strings. You can see in
the given example, the program prompts the user to enter the two strings one by
- C Replace String
Here a function pointer replace is created in which variables st,
orig, repl of pointer type are declared. The st represents the string,
represents the substring which is to be replaced and repl represents the
- C String lowercase
In this section, you will study how to convert the string to lowercase. You
can see in the given example, we have define a string in uppercase characters.
- C String Join
In this section, you will learn how to join the
strings. You can see in the
given example, we have define two strings and initializes two integer variables
length1 and length2 to 0.
- C get Substring from String
This section illustrates you how to get the substring using library function.
You can see in the given example, we have used the library function strstr()
provided by the header file <string.h>.
- C Temperature Converter
Here we are going to illustrates you how to convert temperature from
to Fahrenheit in C. You can see in the given example, we prompt the user to
enter the temperature in celsius.
- C Structure Pointer
This section illustrates you the concept of Structure Pointer in C. You can
see in the given example, we want to access the employee's information through
- C Structure example
Structures in C defines the group of contiguous
(adjacent) fields, such as records or
control blocks. A structure is a collection of variables grouped together under
a single name.
- C String uppercase
In this section, you will learn how to convert a string
value in to uppercase. In the given example, we have define a string in lowercase characters.
- C String Tokenizer
In this section, you will learn how to use strtok()
function to break the
string into a series of tokens. You can see in the given example, we have define
a string and a pointer.
- C String Substring
In this section, you will learn how to get the substring
from a string in
C. You can see in the given example, a string and a method substring() is
- C String Reverse
In this section, you will study how to reverse a string. You can see in the
given example, a recursive function reverse(int i) is created. Inside
the method, we are calculating the length of a specified string using a library
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.