
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 26504 Articles for Server Side Programming

2K+ Views
In this section we will see how to use the fork() to make child process in C. We also do some different tasks in each process. So in our parent process we will print different values.When fork() is called, it returns a value. If the value is greater than 0, then currently it is in parent process, otherwise it is in child process. So using this we can distinguish between the processes.Example Code#include #include int main() { int n = fork(); //subdivide process if (n > 0) { //when n is not 0, then it is ... Read More

7K+ Views
In this article, we implement a C++ program to print a hollow pyramid and diamond pattern. We can create solid Pyramid patterns easily using a loop. To make it hollow, we have to add a few logics. Hollow Pyramid A hollow pyramid is a pattern where a pyramid shape is formed, but only the outer edges (the borders) are filled with characters, while the interior is left empty. Let's explain how we can create hollow pyramid − The first line prints only one star (*). The last line (i.e., the ... Read More

482 Views
std::reference_wrapper is a class template in C++ that allows you to store references to objects or functions in a way that makes them copyable and assignable. Normally, C++ references can't be stored in standard containers like std::vector or std::list, because references are not copyable. std::reference_wrapper solves this problem by internally storing a pointer to the referenced object. It acts like a wrapper around a reference and behaves almost like the original object. It can be passed to functions that take T& (a reference to T), because std::reference_wrapper is implicitly convertible to T&. This is especially useful when you ... Read More

2K+ Views
The fork() system call is used to create a process commonly known as a child process if the fork() returns 0. Otherwise, the created process is known as the parent process. All processes created with fork() execute in parallel. But what if we want the last process to be executed first? In this case, the parent process would execute last because of bottom-to-top execution. This can be done using the wait() system call. The wait system call is used to process handling. It pauses the execution of the calling process until the child process has finished its execution. It's commonly ... Read More

739 Views
In this article, we will see why we should avoid the std::endl while printing lines into the console or a file. We use std::endl to create a new line after the current line. For a few lines of I/O operations, it is not causing any problems. However, a large number of I/O tasks decreases performance. Why We Avoid Using std::endl There are the following reasons to avoid endl: The endl is used to create new lines, but it does not send to the new line only; after sending the cursor to the next line, it ... Read More

4K+ Views
Here, we are going to learn how we can calculate the range of the different C++ data types such as signed data types (int, char, float, etc.) and unsigned data types (unsigned char, unsigned int, unsigned float, etc.). Calculating Range of Signed Data Types In C++, signed data types are used to represent both positive and negative integer values. So, to display their range, we use the following method − Calculate the total number of bits, multiply the sizeof bytes by 8. Calculate -2^(n-1) for minimum range ... Read More

1K+ Views
In this article, we will see how to print a character n times without using loops and recursion in C++. Input/Output Scenario Let's see following input output scenario − Input : n = 10, c = 'i' Output : iiiiiiiiii Input : n = 5, character = 'j' Output : jjjjj Using String Constructor Here, using the string constructor in C++ to print a character n times: It allows initialization of a string with multiple copies of a specific character by passing the number of times and the character itself as arguments. Example In this C++ example, we ... Read More

5K+ Views
What is Expression Tree?An expression tree is a binary tree used to represent expressions. In an expression tree, internal nodes correspond to operators, and each leaf node corresponds to an operand. Let's see an expression and construct a tree for [5 + ((4+3)*2)]. Constructing an Expression TreeOur task is to construct an expression tree from a prefix expression. We have given a character array arr[] representing a prefix expression, so we have to build an expression tree for the expression and then display the infix and postfix expressions of the created tree. Input/Output Scenario Following are the examples to ... Read More

3K+ Views
Array Class In C++, the array class is part of the standard library and is known for its fixed size. The C++ array class, introduced in C++11, offers a better alternative to C-style arrays. The following are the advantages of the array class over a C-style array: Array class knows its size, whereas a C-style array does not have its size. So when passing to functions, we don't need to pass the size of the array as a separate parameter. C-style array there is more risk of array being decayed into ... Read More

24K+ Views
Both vectors and arrays are used to store collections of elements, but they differ significantly in how they manage their memory and flexibility. C++ std::vector A vector is a dynamic array that can be resized automatically when elements are added or removed. It is a part of the C++ STL and provides more flexibility than a static array. Example In the following example, we will demonstrate the usage of the vector in C++ − #include #include using namespace std; int main() { vector > v { { 4, 5, 3}, {2, 7, 6}, {3, 2, 1, 10} }; cout