# C Programming Code Examples

## C > Arrays and Matrices Code Examples

### applying sizeof( ) to determine an array's size

C++ Program Find the Area of a Triangle -
Enter size of each sides of 'triangle'. To find the area of triangle in which values of three sides are given we can use Heron's formula. To apply "Heron's formula" there should be

C++ Switch Statement Control Statement -
"Switch statement" is multi-way decision that tests whether an expression 'matches' one of a number of "constant integer", and branches accordingly. 'Switch statement' that allows us

The C++ Implementation for Binary Heap -
Capacity is the capacity of the "binary heap". Duplicates are allowed. "Throw Overflow" if container is full. Find the smallest item in the "priority queue". Return the smallest item, or

C++ Language Implementation For Queue -
Return the least recently inserted item in the queue or throw "Underflow" if empty. Return and remove the least "recently inserted" item from the queue. "Throw Underflow" if empty.

C++ Language Open and Read File Source -
C++ program opens a file named filename.txt to read the content present inside this file, if there is an error in opening a file then puts a message on the screen for the "error", and if

Find the Frequency of Substring in Strings -
Take a string and a substring as input. Store it in the arrays 'str[] & str1[]' respectively. Using For Loop to 'compare' str1[] with the str[]. Do step2 until the end of main string. During the

Calculate Sum and Difference of Matrices -
C Program calculates the sum & difference of the matrices. Code first reads 2 matrices and then performs both addition and subtraction of matrices. Sum of elements of matrix A and

Function Classes in The C++ Programming -
We have two classes XYZ and ABC. The XYZ class has two "private data members" ch and num, this class declares 'ABC' as Friend Class. This means that 'ABC' can access the private