
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1339 Articles for C

27K+ Views
Backtracking is a technique based on algorithm to solve problem. It uses recursive calling to find the solution by building a solution step by step increasing values with time. It removes the solutions that doesn't give rise to the solution of the problem based on the constraints given to solve the problem.Backtracking algorithm is applied to some specific types of problems, Decision problem used to find a feasible solution of the problem.Optimisation problem used to find the best solution that can be applied.Enumeration problem used to find the set of all feasible solutions of the problem.In backtracking problem, the algorithm ... Read More

4K+ Views
The complete binary tree that follows the properties of heap ordering is called binary heap.Based on the ordering of binary heap, it can be of two types −min Heap is the heap in which the value of node is greater than or equal to the value of its parent node. The root node of min heap is smallest.max Heap is the heap in which the value of node is smaller than or equal to the value of its parent node. The root node of max heap is greatest.The values of binary heap is typically represented as an array. The array ... Read More

2K+ Views
The integer is a data type used to define a number that contains all positive, negative or zero non-fractional values. These cannot have decimals.Float is a data type used to define a number that has a fractional value. These can have decimals also.Now, we will check what will be the value of float and integer return by the compiler when we input the same value for both.Example Live Demo#include using namespace std; int main(){ float f = 23; unsigned int x = 23; cout

904 Views
The array is a collection of a fixed number of items of the same data type. These elements are stored in contiguous memory locations in the memory.Every single element of the value can be accessed from its index value using the brackets “[]” and the array name like a[4], a[3], etc.Declaring ArraysIn c/c++ programming languages, arrays are declared by defining the type and length (number of elements) of the array. The below syntax show declaration of an array in c/c++ −data_tpye array_name[length];For example, declaring an array of type float named the percentage of length 10.float percentage[10]Initializing array valuesIn c++ programming ... Read More

513 Views
Here we will see some MCQ questions on Memory Allocation and Compilation Processes.Question 1 − What will be the output of the following code − Live Demo#include #include int main() { union my_union { int i; float f; char c; }; union my_union* u; u = (union my_union*)malloc(sizeof(union my_union)); u->f = 20.60f; printf("%f", u->f); }Options −Garbage Value20.600000Syntax Error20.6ExplanationUsing unions, we can use same memory location to hold multiple type of data. All member of union uses same memory location which has maximum space. Here ... Read More

2K+ Views
Given a number n, task is to find that any of the digit in the number divides the number completely or not. Like we are given a number 128625 is divisible by 5 which is also present in the number.ExampleInput: 53142 Output: yes Explanation: This number is divisible by 1, 2 and 3 which are the digits of the number Input: 223 Output: No Explanation: The number is not divisible by either 2 or 3The approach used below is as follows −We will start from the unit place and take the unit place’s number.Check whether the number is divisible or ... Read More

10K+ Views
Given an array arr[n] of n number of elements, the task is to find the product of all the elements of that array.Like we have an array arr[7] of 7 elements so its product will be likeExampleInput: arr[] = { 10, 20, 3, 4, 8 } Output: 19200 Explanation: 10 x 20 x 3 x 4 x 8 = 19200 Input: arr[] = { 1, 2, 3, 4, 3, 2, 1 } Output: 144The approach used below is as follows −Take array input.Find its size.Iterate the array and Multiply each element of that arrayShow resultAlgorithmStart In function int prod_mat(int arr[], ... Read More

1K+ Views
Given a number n and we have to print the arrow star pattern of maximum n number of stars.The star pattern of input 4 will look like −ExampleInput: 3 Output:Input: 5 Output:The approach used below is as follows −Take input in integer.Then print n spaces and n stars.Decrement till n>1.Now increment till n.And print spaces and stars in increasing order.AlgorithmStart In function int arrow(int num) Step 1-> declare and initialize i, j Step 2-> Loop For i = 1 and i

967 Views
Given two matrices MAT1[row][column] and MAT2[row][column] we have to find the difference between two matrices and print the result obtained after subtraction of two matrices. Subtraction of two matrices are MAT1[n][m] – MAT2[n][m].For subtraction the number of rows and columns of both matrices should be same.ExampleInput: MAT1[N][N] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}} MAT2[N][N] = { {9, 8, 7}, {6, 5, 4}, {3, 2, 1}} Output: -8 -6 -4 -2 0 2 4 6 8Approach used below is as follows −We will iterate both matrix for every row and column and ... Read More

1K+ Views
Given an array arr[n] where n is some size of an array, the task is to find out that the array is palindrome or not using recursion. Palindrome is a sequence which can be read backwards and forward as same, like: MADAM, NAMAN, etc.So to check an array is palindrome or not so we can traverse an array from back and forward like −In recursion also we have to change the start and end value till they are equal or when the values as start and end are not equal then exit and return false that the given array is ... Read More