
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

626 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

651 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

76K+ 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

12K+ Views
fwrite() and fread() is used to write to a file in C.fwrite() syntaxfwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)whereptr - A pointer to array of elements to be writtensize - Size in bytes of each element to be writtennmemb - Number of elements, each one with a size of bytesstream – A pointer to a FILE object that specifies an output streamfread() syntaxfread(void *ptr, size_t size, size_t nmemb, FILE *stream)whereptr - A pointer to a block of memory with a minimum size of size*nmemb bytes.size - Size in bytes of each element to be read.nmemb - Number of ... Read More

15K+ Views
Listing files in a directory is used to write a program that opens a specified folder (e.g: "/myfiles"), reads its contents, and displays the names of each file and subfolder one by one. In C/C++, to see all the files in a directory, you can use special system functions that let you read the directory's contents. In real life, we open folder to see the contents inside the files. Similarly, in C or C++, we can write a program to display all the files and folders in a directory. Algorithm Following is the algorithm to get the list of files ... Read More

662 Views
In C/C++, a null pointer is a special pointer that does not point to any valid memory location. Address 0 is used for Null Pointers because address 0 is reserved by the system, and it is guaranteed not to be used for valid data. So, when a pointer is assigned the value 0 (or nullptr), it means the pointer points to nothing. Some uses of null pointers are: To initialize a pointer variable when that pointer variable isn't assigned any valid memory address yet. To pass a null pointer to a function ... Read More