Revathi Satya Kondra has Published 72 Articles

Compare *ptr++, *++ptr and ++*ptr in C++

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Apr-2025 18:03:55

3K+ Views

In C++, both ptr++ and ++ptr are used to increment pointers, but they behave differently in expressions. The difference lies in when the increment happens: before or after the value is used. This is essential when working with loops, arrays, or pointer. Syntax Following is the syntax to compare ptr++ ... Read More

Dangling, Void, Null and Wild Pointers in C++

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Apr-2025 18:02:08

814 Views

In C++, direct memory access is possible using pointers. However, the improper use of pointers can lead to problems such as dangling pointers, null pointers, void pointers, and wild pointers. You must have to fix these problems properly for correct code compilation and execution. Let us learn how these problems ... Read More

Why use static_cast(x) instead of (int)x in C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Apr-2025 18:01:00

2K+ Views

The (int)x is C-style typecasting, where static_cast(x) is used in C++. This static_cast() gives a compile-time checking facility, but the C-style casting does not support that. This static_cast() can be spotted anywhere inside a C++ code. And using this C++ cast, the intentions are conveyed much better. In C like ... Read More

Single quotes vs. double quotes in C or C++

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Apr-2025 18:00:27

8K+ Views

When coding in C/C++, we go across single quotes (' ') and double quotes (" "). These symbols have different roles in the language. Single quotes stand for single characters, while double quotes define strings, which are groups of characters. Knowing this difference has an impact on how data gets ... Read More

Find out the current working directory in C/C++

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Apr-2025 18:00:07

7K+ Views

To find the Current Working Directory (CWD) in C or C++ is like asking your program: "Hey, where am I right now?". Simply we can say that it is like a folder of your program which is present and used to operate in. We can use functions like getcwd() from ... Read More

How do you declare an interface in C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Apr-2025 17:58:16

446 Views

The C++ interfaces are implemented using abstract classes and these abstract classes should not be confused with data abstraction which is a concept of keeping implementation details separate from associated data. A class is made abstract by declaring at least one of its functions as a pure virtual function. A ... Read More

Standard Size of character (\'a\') in C/C++ on Linux

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Apr-2025 17:56:51

5K+ Views

In C/C++, every character including 'a' is stored using a specific size in memory. Most of the systems including Linux, the size of a character is 1 byte. This means that any character (like a) can occupy 1 byte(8 bits of memory). To determine how much memory is used by ... Read More

Differences between pass by value and pass by reference in C++

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 11-Apr-2025 22:19:12

22K+ Views

In C++, there are two main ways to pass arguments to functions: pass by value and pass by reference. When you use pass by value, a copy of the variable is made, so the original variable doesn't change. With pass by reference, the function works with the original variable, so ... Read More

Levels of Pointers in C/C++

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 11-Apr-2025 22:04:00

214 Views

In C/C++, the pointers have multiple levels, which means a pointer can point to another pointer – so the chains of indirection can go on and on. For instance, a pointer to a variable's address is stored at "*ptr" (single-level pointer) while, at "**ptr", the address of another pointer is ... Read More

Understanding cin.clear() and cin.ignore() in C++

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 11-Apr-2025 17:33:40

1K+ Views

When we attempt to work with user input in C++, unwanted behavior may be caused by errors or leftover characters in the input buffer. So, in that case cin.clear() and cin.ignore() are functions that can help in dealing with this kind of problem. cin.clear() ... Read More