
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
Server Side Programming Articles - Page 2298 of 2651

2K+ Views
In this section we will see how to convert an integer number to a string.The logic is very simple. Here we will use the sprintf() function. This function is used to print some value or line into a string, but not in the console. This is the only difference between printf() and sprintf(). Here the first argument is the string buffer. where we want to save our data.Input: User will put some numeric value say 42Output: This program will return the string equivalent result of that number like “42”Algorithm:Step 1: Take a number as argument Step 2: Create an empty ... Read More

1K+ Views
A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case.The syntax for a switch statement in C programming language is as follows −switch(expression) { case constant-expression : statement(s); break; /* optional */ case constant-expression : statement(s); break; /* optional */ /* you can have any number of case statements */ default : /* Optional */ ... Read More

24K+ Views
In this article, we will demonstrate how to implement an AVL tree. An AVL tree is a self-balancing binary search tree in which the height difference between the left and right subtrees (balance factor) of any node cannot exceed one. AVL TREE Following are the points of an AVL tree − Tree rotation is a way to change the structure of an AVL tree without changing the order of the elements. It helps keep the tree balanced by moving one node up and one node down. Tree rotations are mainly used ... Read More

1K+ Views
In this section we will see what are the differences between *ptr++, *++ptr and ++*ptr in C++.Here we will see the precedence of postfix++ and prefix++ in C or C++. The precedence of prefix ++ or -- has higher priority than dereference operator ‘*’ and postfix ++ or -- has priority higher than both prefix ++ and dereference operator ‘*’.When ptr is a pointer, then *ptr++ indicates *(ptr++) and ++*prt refers ++(*ptr)Example Code Live Demo#include using namespace std; int main() { char arr[] = "Hello World"; char *ptr = arr; ++*ptr; cout

1K+ Views
A hash table is a data structure which is used to store key-value pairs. Hash function is used by hash table to compute an index into an array in which an element will be inserted or searched.Linear probing is a collision resolving technique in Open Addressed Hash tables. In this method, each cell of a hash table stores a single key–value pair. If a collision is occurred by mapping a new key to a cell of the hash table that is already occupied by another key. This method searches the table for the following closest free location and inserts the ... Read More

2K+ Views
Hash Table A hash table is a data structure which is used to store key-value pairs and uses hash function to compute an index into an array of buckets or slots in which an element will be inserted or searched in average-case constant time. Why are Collision a Problem? A collision is a problem because even a perfect hash function can generate the same index for multiple keys, causing a collision. To resolve these, we use techniques like − Chaining Linear Probing Quadratic Probing Quadratic Probing ... Read More

7K+ Views
Sometimes, you may come across a scenario where you want to have a function that can take a variable number of arguments, i.e., parameters, instead of a predefined number of parameters. The C/C++ programming language provides a solution for this scenario, and you are allowed to define a function that can accept a variable number of parameters based on your requirement. Following are the ways to use variable number of arguments − C-style Variadic Functions (with stdarg.h) C-style variadic functions in C++ use stdarg.h macros like va_start, va_arg, and va_end to handle a variable number of arguments at runtime. int ... Read More

6K+ Views
Heap OverflowHeap is used to store dynamic variables. It is a region of process’s memory. malloc(), calloc(), resize() all these inbuilt functions are generally used to store dynamic variables.Heap overflow occurs when −A) If we allocate dynamic large number of variables −int main() { float *ptr = (int *)malloc(sizeof(float)*1000000.0)); }B) If we continuously allocate memory and do not free after using it.int main() { for (int i=0; i

2K+ Views
Before knowing the solution to clearing the cin buffer in C++, let us first see what the buffer is in C++. What is The Buffer in C++ A buffer is a temporary storage area that holds data while standard I/O devices are in use. In C++, a stream also work as a buffer. When a key is pressed, the input is not immediately sent to the program; instead, it is stored in a buffer. The operating system keeps this data in the buffer until the program is allocated time to process it. Why We Clear The cin Buffer in C++ ... Read More

668 Views
Heap and stack overflows are both types of buffer overflows that occur when a program attempts to write data beyond the allocated boundary of a buffer. Heap Overflow Heap is used to store dynamic variables. It is a region of process’s memory. malloc(), calloc(), resize() all these inbuilt functions are generally used to store dynamic variables. Following are the regions where heap overflow occurs − If we allocate dynamic large number of variables int main() { float *ptr = (int *)malloc(sizeof(float)*1000000.0)); } If we continuously allocate memory and do not free after using it. int main() { for (int i=0; i