
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 2301 of 2651

887 Views
In C++, a conversion constructor is a special type of constructor that takes only one argument. It enables automatic type conversion from the argument's type to the class type. When an object of the class to be created from a single value(int). then the compiler will call the conversion constructor to create the object from that value. This can be implicit conversion of a value into a class object. Creating Conversion Constructor Following is the syntax to the Conversion Constructor in C++: class ClassName { public: ClassName(Type arg); // Conversion constructor }; Here, ... Read More

705 Views
Character literals are those values, which are assigned to the variable of character data type. It is written as a single character enclosed in single quotes (' ') like 'A', 'b' or '2'. But if we see how these character literals are stored in memory, their type differs. In C the character literals are stored as type int, whereas the same character literal is stored as type char in C++. In this article, we will study about the differences between these two in detail. Type of character literal in C The type of character literals in C language is an integer ... Read More

2K+ Views
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 Live Demo#include using namespace std; int main() { char arr[] = "Hello World"; char *ptr = arr; ++*ptr; cout

354 Views
A scope is a region of the program and broadly speaking there are three places, where variables can be declared −Inside a function or a block which is called local variables, In the definition of function parameters which is called formal parameters.Outside of all functions which is called global variables.We will learn what is a function and it's parameter in subsequent chapters. Here let us explain what are local and global variables.Local VariablesVariables that are declared inside a function or block are local variables. They can be used only by statements that are inside that function or block of code. ... Read More

644 Views
In C/C++, Line splicing is a small feature that lets you split one long line of code into two lines by using a special symbol that is the backslash (\).Line splicing is a preprocessor feature, not a function or method. It does not have any parameters. But it simply affects how lines of code are interpreted by the preprocessor before compilation.How to Use Line Splicing? If a line of code is too long, and you want to break it into multiple lines to make it easier to read. You can use a backslash at the end ... Read More

661 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.This is a C++ program to Implement Hash Tables chaining with doubly linked lists.AlgorithmFor insert:Begin Declare Function insert(int k, int v) int hash_v= HashFunc(k) HashTableEntry *en = ht[hash_v] if (en == NULL) en = new HashTableEntry en->d = v en->k = k ... Read More

21K+ 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.This is a C++ program to Implement Hash Tables.AlgorithmBegin Initialize the table size T_S to some integer value. Create a structure hashTableEntry to declare key k and value v. Create a class hashMapTable: Create a constructor hashMapTable to create the table. Create a hashFunc() function which return key mod T_S. Create a function Insert() to insert element at ... Read More

7K+ Views
The binary file stores data in binary format, and data can be written using the write() or fwrite() method in C++. Writing to a Binary File To write a binary file in C++, use write method like fwrite()/write() method. It is used to write a given number of bytes on the given stream, starting at the position of the "put" pointer. The file is extended if the put pointer is current at the end of the file. If this pointer points into the middle of the file, characters in the file are overwritten with the new data. If any error ... Read More

2K+ Views
To read an entire file into a std::string in C++, you can open the file using std::ifstream, read its contents using a std::stringstream or by moving the file pointer at the specified position, and then store the result in a std::string. Algorithm Here is a simple algorithm to read an entire file into a std::string in C++: Begin. Open the file using an ifstream object. Check if the file is successfully opened. Create an ostringstream object. Read the file content using rdbuf() and write it into the ostringstream. ... Read More

77K+ Views
Writing a Binary File To write a binary file in C/C++ use fwrite()/write() method. It is used to write a given number of bytes on the given stream, starting at the position of the "put" pointer. The file is extended if the put pointer is currently at the end of the file. If this pointer points into the middle of the file, characters in the file are overwritten with the new data. If any error has occurred during writing in the file, the stream is placed in an error state. Syntax of write() method Following is the basic syntax of ... Read More