Revathi Satya Kondra has Published 101 Articles

Absolute Difference of all pairwise consecutive elements in an array (C++)?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 01-Aug-2025 18:06:10

651 Views

An array in C++ is a data structure used to store multiple values of the same type in a contiguous block of memory. To know that how values shift from one index to the next, a common and practical technique is to compute the absolute difference between each pair of ... Read More

C++ Program for the Common Divisors of Two Numbers?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 31-Jul-2025 18:17:56

2K+ Views

What are Common Divisors? The common divisors of two numbers are the numbers that are divisors of both. A number is said to divide another number if it leaves no remainder when divided. For example, 3 divides 12 since 12 / 3 = 4 ... Read More

Can we use function on left side of an expression in C and C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Jun-2025 14:49:02

386 Views

In C, you cannot use a function call on the left side of an assignment if it returns a value because function calls return non-assignable values. For example, function_name() = value; However, if the function returns a pointer, you can dereference it to assign a value. For example, *function_name() = ... Read More

Why is address zero used for the null pointer in C/C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Jun-2025 14:27:30

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

Writing a binary file in C++

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 17-Jun-2025 14:05:43

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

How do I define string constants in C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 16-Jun-2025 17:34:21

14K+ Views

In C++, a string constant also called a string literal is a fixed sequence of characters enclosed in double quotes (" "). For example: "This is a string" and it is used to read-only memory, and its value cannot be changed during the program. Defining C++ Strings ConstantsYou can define ... Read More

How to read a text file with C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 13-Jun-2025 13:18:16

75K+ Views

In C++, you can read data from a text file using file handling features provided by the header. This is useful when you want your program to read input stored in a file instead of typing it every time. To do this, you use a special object called ifstream (input ... Read More

How can I get the list of files in a directory using C or C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 13-Jun-2025 12:59:07

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

What is the relation between auto and decltype in C++?

Revathi Satya Kondra

Revathi Satya Kondra

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

1K+ Views

The auto and decltype serve different purposes so they don't map one-to-one. The auto is a keyword in C++11 and later that is used for automatic type deduction. The decltype type specifier yields the type of a specified expression. Unlike auto that deduces types based on values being assigned to ... Read More

What is type deduction in C++?

Revathi Satya Kondra

Revathi Satya Kondra

Updated on 13-Jun-2025 12:54:09

1K+ Views

Type inference (or type deduction) refers that the compiler can figure out the datatype of a variable or expression automatically, without the programmer needing to write it out. This feature is available in many strongly typed languages like C++, where the type system is strict but the compiler helps to ... Read More

1 2 3 4 5 ... 11 Next
Advertisements