From the category archives:

C

C Programming Language Cheat Sheet

C Language Cheat Sheet for learning shortcuts to common problems, list of useful syntax and other information to make coding easier

C Programming

Use of Switch to Calculate Area

Using Switch statement to create a Menu Driven program to calculate Area of different shapes.

C Programming

Count number of Words in a String

Program to count number of words in a Line in C Source Code.

C Programming

Count number of Vowels and Consonants in a String

Program to count number of Vowels (a,e,i,o,u) and consonants in a String in C

C Programming

Finding String Length in C

Program to count the number of characters in a given string using while loop. Useful for calculating the length of a given string as C doesn’t have an inbuilt function for the same.

C Programming

Sorting a String

Program to Sort a given String in C.

C Programming

Splitting an Array

The following program splits an array into two different arrays of equal length.

C Programming

Recursion using Fibonacci Series

This program demonstrates recursion using Fibonnacci Series program.

C Programming

How to find prime numbers in a given range

Logic behind the program is to check till half of the number (n/2) because it has been observed that the remainders get repeated after half of the number. Therefore, checking for remainders till n/2 is sufficient enough. The use of modulus operator(%) is important in this regard.

C Programming

How to check if a string is a Palindrome

A String can be checked for palindrome using two while loops. One for counting the string length and second for checking the [i]th element of the substring with the original string to be compared with.

C Programming

Sum of Digits of a Number

Sum of Digits of a number is taken out in two steps. One, using the modulus operator (%) and taking remainder by dividing by 10 to get individual digits and then diving the number itself by 10 to reduce the least significant. It is similar to reversing digits of the number.

C Programming

Reverse digits of a number

Reverse of Digits of a number is taken out in two steps. One, using the modulus operator (%) and taking remainder by dividing by 10 to get individual digits and then diving the number itself by 10 to reduce the least significant. It is similar to taking sum of digits.

C Programming

Merging two sorted arrays

Program to merge two sorted arrays in C

C Programming

Selection Sort

Selection sort is a sorting algorithm, specifically an in-place comparison sort. Selection sort is noted for its simplicity, and also has performance advantages over more complicated algorithms in certain situations.

C Programming

Transpose of Matrix

Transpose of a Matrix is one of the operations performed on Matrices wherein the transpose of a matrix A is a matrix formed from A by interchanging the rows and columns such that row i of matrix A becomes column i of the transposed matrix.

C Programming

Sum of two Matrices

Sum of two Matrices is one of the operations performed on Matrices wherein Matrix A and Matrix B are are summed together resulting in a Matrix C which is the new Matrix formed by addition of A & B.

C Programming

Sum of Diagonals of Matrix

Sum of Diagonals of a Matrix is one of the operations performed on Matrices wherein the individual elements on the Diagonal of the Matrix are summed together.

C Programming

Malloc – Allocate memory dynamically to an Array

The malloc function is one of the functions in standard C to allocate memory. Upon successful allocation, malloc returns a void pointer (void *), which indicates that it is a pointer to a region of unknown data type. Here, we’ll use malloc() to dynamically assign memory from the HEAP to an array at runtime. Language [...]

Page 1 of 3123

WordPress - Vaibhav Kanwal