Akansha Kumari

Akansha Kumari

Hi, I am Akansha, a Technical Content Engineer with a passion for simplifying complex tech concepts.

About

Hi, I am Akansha, a Technical Content Engineer with a passion for simplifying complex tech concepts. I specialize in creating technical, accurate, and SEO-optimized content that helps learners, developers, and professionals understand programming languages and other computer-related concepts.

54 Articles Published

Articles by Akansha Kumari

Page 5 of 6

How to initialize memory with a new operator in C++?

Akansha Kumari
Akansha Kumari
Updated on 06-May-2025 1K+ Views

In C++, the new operator is mainly used for allocating memory on the heap, but to initialize that memory, you need to explicitly declare and provide a value to it.Here, the new operator dynamically allocates memory for a variable or object during runtime and returns a pointer to the allocated memory.  Here are the following ways you can initialize memory using the new operator: For built-in types For arrays For objects new Operator in Built-in Types The built-in types are the basic data types in C++, which ...

Read More

What is the difference between cerr and clog streams in c++?

Akansha Kumari
Akansha Kumari
Updated on 05-May-2025 1K+ Views

cerr and clog are both objects of the stderr(standard error) stream, which is used to display error messages or diagnostics. In this article, we will learn the difference between these two in more detail. Further, the description of the cout object is also given to get a clearer picture. Unbuffered standard error stream (cerr) The cerr is the standard error stream, which is used to output the errors. This is also an instance of the ostream (as iostream means input/output stream) class. As cerr is unbuffered, therefore it's used when we need to display the error message instantly. It doesn't ...

Read More

What is double address operator(&&) in C++?

Akansha Kumari
Akansha Kumari
Updated on 05-May-2025 21K+ Views

&& is a new reference operator defined in the C++11 standard. int&& a means "a" is an r-value reference. && is normally only used to declare a parameter of a function. And it only takes an r-value expression.Simply put, an r-value is a value that doesn't have a memory address. E.g., the number 6 and character 'v' are both r-values. int a, a is an l-value, however, (a+2) is an r-value. Example #include using namespace std; void foo(int&& a) { cout

Read More

What is the difference between cin and cout streams in c++?

Akansha Kumari
Akansha Kumari
Updated on 05-May-2025 17K+ Views

cin is an object of the input stream and is used to take input from input streams like files, console, etc. cout is an object of the output stream that is used to show output. Basically, cin is an input statement while cout is an output statement.They also use different operators. cin uses the insertion operator( >> ) while cout uses the extraction operator( >), which helps to extract the input from the cin and stores it in a variable. It automatically skips the whitespaces (spaces, tabs, newlines) until a special method like getline() is used. Syntax Here is the ...

Read More

What is the difference between cerr and cout streams in c++?

Akansha Kumari
Akansha Kumari
Updated on 02-May-2025 5K+ Views

cout is an object of the stdout stream, while cerr is an object of the stderr stream.stdout and stderr are different streams, even though they both refer to console output by default. Redirecting (piping) one of them (e.g., program.exe >out.txt) would not affect the other. These are both provided by the library in C++. In this article, we will learn the difference between these two output streams in more detail. Character Output Stream (cout) The character output stream is used to display the data or information to the console (standard output device, basically the screen), like printing messages, results, ...

Read More

Semicolons in C++

Akansha Kumari
Akansha Kumari
Updated on 30-Apr-2025 1K+ Views

A semicolon in C++ is used to terminate or end the statement; it tells the compiler that this particular instruction is completed.According to the ISO C++ specifications, the lexical representation of C++ programs (breaking down code into small parts) is called tokens. Some of these tokens are punctuators, which are special symbols used to structure your code. The semicolon is one of these punctuators. Example Here is the following basic example code showcasing the working of a semicolon in C++. #include using namespace std; int main() { int x = 5; // End of declaration statement x = 10; // End of assignment statement cout

Read More

C program to Implement Kadane’s Algorithm

C
Akansha Kumari
Akansha Kumari
Updated on 25-Apr-2025 461 Views

We are given an array of integers, and we need to find the maximum sum of a contiguous subarray using Kadane’s Algorithm. Kadane’s Algorithm is an efficient way to find the maximum subarray sum in O(n) time complexity. For example, in the array {-2, 1, -3, 4, -1, 2, 1, -5, 4}, the subarray [4, -1, 2, 1] has the maximum sum 6. In this article, we are going to implement Kadane's algorithm using C. What Is Kadane's Algorithm? Kadane's algorithm is a popular and optimal algorithm used to find the maximum sum of a contiguous subarray in a given ...

Read More

Trigraphs in C++

Akansha Kumari
Akansha Kumari
Updated on 22-Apr-2025 438 Views

Trigraphs in C++ are special three-character sequences that represent a certain single character, which may not be available on some keyboards or systems. Previously, the ISO-646 character set did not have all the characters of the C syntax; therefore, some systems with their keyboard and display faced problems while dealing with those few characters.So the trigraphs have been introduced, which start with two question marks (??) and are further followed by a third character, which the compiler considers as a particular equivalent single-character. Trigraphs Table in C++ There are a total of nine trigraphs available in C++; here is the ...

Read More

Whitespace in C++

Akansha Kumari
Akansha Kumari
Updated on 22-Apr-2025 9K+ Views

The term Whitespace in C++ refers to the characters used for formatting, like creating spaces, tabs, and newlines. These are usually invisible in the source code output (meaning they don't appear in the actual program output); they just help to format the code and improve readability. Types of whitespace characters Here are the following four common types of whitespace characters mostly used in C++. Space (' ') Tab ('\t') Newline ('') Carriage return ('\r') Space (' ') It's a most basic whitespace ...

Read More

What is the const Keyword in C++?

Akansha Kumari
Akansha Kumari
Updated on 17-Apr-2025 856 Views

The const keyword in C++ is a keyword that is used to declare variables and objects as constant, which means the value declared using const cannot be changed or modified later, once they are initialized. This helps them prevent accidental modifications. For example, in a code, if we are using the value of PI, which has a fixed universal value and doesn't need any change, then we can declare it as a constant. When you declare the object with the const keyword, then the compiler places that value in ROM (Read-Only Memory), which protects it from being changed ...

Read More
Showing 41–50 of 54 articles
Advertisements