
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 33676 Articles for Programming

22K+ Views
Relational OperatorsRelational operators are used to compare two values in C language. It checks the relationship between two values. If relation is true, it returns 1. However, if the relation is false, it returns 0.Here is the table of relational operators in C languageOperatorsOperator Name==Equal to>Greater than=Greater than or equal toy) printf("x is greater than y "); if(x

20K+ Views
External variables are also known as global variables. These variables are defined outside the function. These variables are available globally throughout the function execution. The value of global variables can be modified by the functions. “extern” keyword is used to declare and define the external variables.Scope − They are not bound by any function. They are everywhere in the program i.e. global.Default value − Default initialized value of global variables are Zero.Lifetime − Till the end of the execution of the program.Here are some important points about extern keyword in C language, External variables can be declared number of times ... Read More

2K+ Views
Increment operators are used to increase the value by one while decrement works opposite increment. Decrement operator decreases the value by one.Here is the syntax of pre-increment operator in C language, ++variable_name;Here is the syntax of pre-decrement operator in C language, --variable_name;Let us see the difference between pre-increment and pre-decrement operator.Pre-increment − Before assigning the value to the variable, the value is incremented by one.Here is an example of pre-increment in C language, Example Live Demo#include int main() { int i = 5; printf("The pre-incremented value : %d", i); while(++i < 10 ) printf("%d\t", i); ... Read More

187 Views
The sinh() function returns the hyperbolic sine of an angle given in radians. It is an inbuilt function in C++ STL.The syntax of the sinh() function is given as follows.sinh(var)As can be seen from the syntax, the function sinh() accepts a parameter var of data type float, double or long double. It returns the hyperbolic sine of var.A program that demonstrates sinh() in C++ is given as follows.Example Live Demo#include #include using namespace std; int main() { double d = 5, ans; ans = sinh(d); cout

557 Views
The function strncat() in C++ is used for concatenation. It appends the specified number of characters from the source string at the end of the destination string and returns a pointer to the destination string. The syntax of strncat() is given as follows.char * strncat ( char * dest, const char * src, size_t num );In the above syntax, the source string src is appended at the end of the destination string dest till num characters only.A program that demonstrates strcat() is given as follows.Example Live Demo#include #include using namespace std; int main() { char str1[20] = "Programming ... Read More

726 Views
Both strcat() and strncat() are predefined string functions in C++. Details about these are given as follows.strcat()This function is used for concatenation. It appends a copy of the source string at the end of the destination string and returns a pointer to the destination string. The syntax of strcat() is given as follows.char *strcat(char *dest, const char *src)A program that demonstrates strcat() is given as follows.Example Live Demo#include #include using namespace std; int main() { char str1[20] = "Mangoes are "; char str2[20] = "yellow"; strcat(str1, str2); cout

12K+ Views
VariablesIn C language, variables are the storage place where some form of data is stored. Different variables require different amount of memory on which a set of operations is applied.A variable name cannot start with a number. It can consist of alphabets, number, underscore “_”.Here is the syntax of declaring variables in C language, type variable_name;Here is the syntax of multiple variables declaration in C language, type variable_name1, variable_name2, variable_name3;The following is an example of variables in C language, Example Live Demo#include int main() { char a1 = 'H'; int b = 90, c = 150; float ... Read More

1K+ Views
Tree traversal is a form of graph traversal. It involves checking or printing each node in the tree exactly once. The preorder traversal of a binary search tree involves visiting each of the nodes in the tree in the order (Root, Left, Right). An example of Preorder traversal of a binary tree is as follows. Here, we start at the root(3), then go to the left child (6), then its left(5), then right(2), then come back and move to the right subtree of 3 that is (4), then 9, and finally 8. Non-Recursive Preorder Traversal of ... Read More

6K+ Views
The factorial of a positive integer n is equal to 1*2*3*...n. Factorial of a negative number does not exist. Here a C++ program is given to find out the factorial of a given input using dynamic programming.AlgorithmBegin fact(int n): Read the number n Initialize i = 1, result[1000] = {0} result[0] = 1 for i = 1 to n result[i] = I * result[i-1] Print result EndExample Code#include using namespace std; int result[1000] = {0}; int fact(int n) { if (n >= 0) { result[0] = 1; for (int i = 1; i

3K+ Views
Heap Sort is based on the binary heap data structure. In the binary heap the child nodes of a parent node are smaller than or equal to it in the case of a max heap, and the child nodes of a parent node are greater than or equal to it in the case of a min heap.An example that explains all the steps in Heap Sort is as follows.The original array with 10 elements before sorting is −207154101590237725This array is built into a binary max heap using max-heapify. This max heap represented as an array is given as follows.907720542515123710The root ... Read More