Revathi Satya Kondra has Published 101 Articles

What should we assign to a C++ pointer: A Null or 0?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 12-Jun-2025 14:25:46

1K+ Views

In C++, a pointer stores the address of another variable, which means that the pointer itself does not contain a value of its own. However, you can assign a null value or a 0 to a pointer, in which case the pointer will not point to the address of any ... Read More

vector::begin() and vector::end() in C++ STL

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 12-Jun-2025 14:07:46

5K+ Views

In C++, a vector is a dynamic array provided by the Standard Template Library (STL) that can grow or shrink in size and can store multiple elements of the same type (like int, string, etc.). Instead of accessing elements one by one using indexes like vec[0], vec[1], etc., The C++ ... Read More

set::begin() and set::end() in C++ STL

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 12-Jun-2025 14:01:51

1K+ Views

The begin() and end() functions are member functions of the std::set container, which is defined in the header file. The std::set in C++ STL (Standard Template Library) always stores its elements in sorted order. So when you use begin() and end() functions, the elements in the set, which are automatically ... Read More

How to append text to a text file in C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 12-Jun-2025 13:55:57

7K+ Views

Appending text means adding new content to an existing file without removing its current content. In C++, this can be done by opening the file in append mode and writing the specified content to it. Steps to Append Text to a Text File You need to follow the below steps ... Read More

What is the easiest way to initialize a std::vector with hardcoded elements in C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 12-Jun-2025 13:45:58

657 Views

In C++, a std::vector is a container that is a part of the STL (Standard Template Library). It enables dynamic arrays which can adjust their size automatically. Depending on the requirements and version of C++ being used, there are many ways to initialize a std::vector with hardcoded elements. Initializing a ... Read More

What is the difference between a definition and a declaration in C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 12-Jun-2025 12:36:35

2K+ Views

In C++, declaration and definition are often confused. A declaration tells the compiler about the name and type, while a definition allocates memory or provides implementation. In this article, we will understand their differences with examples. What is a Declaration in C++? A declaration means (in C or C++) that ... Read More

What is the best way to read an entire file into a std::string in C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 10-Jun-2025 15:02:33

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 ... Read More

Builtin functions of GCC compiler in C++

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 10-Jun-2025 14:33:31

722 Views

When you want to write a program in C++, your compiler (like GCC) converts your code into computer language. While doing this, GCC offers some special functions called built-in functions. The built-in functions are predefined functions by the compiler itself, but not provided by any standard library. The GCC compiler ... Read More

How does “void *” differ in C and C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 10-Jun-2025 14:27:29

616 Views

Both languages (C and C++) support void pointers, but their behaviour is different. In C, a void pointer can be directly assigned to any other pointer type without the need for a typecast. However, in C++, assigning a void pointer to any other pointe type require an explicit typecast. In ... Read More

Wide char and library functions in C++

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 10-Jun-2025 13:24:03

4K+ Views

Wide Characters Wide characters are similar to character datatype. The main difference is that char takes 1-byte space, but wide character takes 2-bytes (sometimes 4-byte depending on compiler) of space in memory. For 2-byte space wide character can hold 64K (65536) different characters. So the wide char can hold UNICODE ... Read More

Advertisements