# C Programming Code Examples

## C > Arrays and Matrices Code Examples

### count frequency of each element in an array

Find the Shortest Path from Source Vertex -
Find the shortest path in linear time. This can be done by using the Dijkstra'a Shortestpath algorithm. A utility function to find the vertex with minimum distance value, from the set of

C Display the Characters in Prime Position -
Take a string as input and store it in the array str[]. "Store the Length" of the input string in the variable 'k'. Use "two Loops" to divide the numbers "upto the value" of k. Increment the

C Language Print Natural Numbers 1 to N -
C program print all natural numbers from 1 to n using loop. Input upper limit to print natural number from user. Store it in a variable say N. Run a For Loop from 1 to N with 1 increment.

Check Even or Odd using Conditional and -
C input any number and check whether the given number is even or odd using bitwise operator. Check to whether a number is even or odd using bitwise operator in C. Logic to

C Code Find Reverse of String by Pointers -
Input a 'string from user', store it in a variable say str. 'Declare another Array' that will store 'reverse of the string', say char reverse[SIZE]. Find Length of the string and store it in some

Use the Break Statement in C++ language -
It's used in switch case control structure after the case blocks. Generally all cases in switch case are followed by a "Break Statement" to avoid the subsequent cases (see the example

identical to scanf() example in C language -
C programming code to Identical to scanf() except that data is from buf. The number of variables assigned. A value of zero means that no fields were assigned. EOF indicates

C Nth Fibonacci Numbers using Recursion -
Prints the Fibonacci of a given number using recursion. In fibonacci series, each number is the sum of the two preceding numbers. 0, 1, 1, 2, 3, 5, 8, ... The following program returns