Tapas Kumar Ghosh has Published 183 Articles

Pre-increment and Post-increment concept in C/C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 21-May-2025 18:16:42

11K+ Views

Both pre-increment and post-increment are used to represent the expression of increasing a value by adding 1. Their behavior are different because pre-increment (++i) increases the value before it is used in an expression, while post-increment (i++) increases it after. Below is the key-terms of pre-increment and post-increment in C/C++: ... Read More

Reverse a string in C/C++

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 21-May-2025 18:03:29

2K+ Views

There can be multiple ways to reverse a string in C and C++. In this article, we will learn reversing a string using different approaches with the appropriate examples. Consider the below example with input and output scenarios: Input // characters representation from left to right inp = "Tutorialspoint" ... Read More

C++ Program to Add Two Distances (in inch-feet) System Using Structures

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 21-May-2025 17:29:39

742 Views

A structure is a collection of items of different data types. It is very useful in creating complex data structures with different data type records. A structure is defined with the struct keyword. An example of a structure is as follows: struct DistanceFI { int feet; ... Read More

C++ Program to Sort Elements in Lexicographical Order (Dictionary Order)

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 21-May-2025 17:28:52

2K+ Views

Lexicographical order denotes the way the words are ordered in a list, based on alphabetical order according to their alphabets. For example: List of words: Harry Adam Sam Lexicographical order of words: Adam Harry Sam Sorting String Based on Lexicographical Order To implement the string in ... Read More

Pass an array by value in C

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 05-May-2025 18:36:54

827 Views

In C programming, when you pass an array by value, you are not sending the entire array. Instead of this, it passes a pointer to the first element. So, this shows functions directly work with an original array but do not copy. Note: If we make any changes to the ... Read More

How to convert a single character to string in C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 05-May-2025 18:36:35

264 Views

In C++, a single character is represented using a single quotation (' ') while a string is represented using a double quotation (" "). To change the single character into a string, use approaches like string_constructor, push_back(), etc., that solve the conversion. Example Input: ch = 'A' Output: str = ... Read More

Difference Between int and long

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 05-May-2025 18:35:59

6K+ Views

In programming, int and long are the part of primitive data type. The int stores the integer value while long stores the larger range of values like a whole number. In this article, we will see the differences between int and long data types. int (Integer) Data Type The keyword ... Read More

Left Shift and Right Shift Operators in C/C++

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 02-May-2025 18:02:48

2K+ Views

Both the left shift and right shift are known as bitwise shift operators. These operators are useful for working with binary integers by shifting the bits to the left or right. Below is the mathematical representation of the left and right shift operators: // left shift operator x > n ... Read More

How to calculate Execution Time of a Code Snippet in C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 02-May-2025 18:01:54

2K+ Views

To calculate the execution time of a program, use the std::chrono library, which was introduced in C++11. This library has two distinct objects: time_point and duration. The time_point represents the variable names that store the start and end times of specific algorithms, functions, or loops used in the program. While ... Read More

Why are global variables bad in C/C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 02-May-2025 18:00:43

3K+ Views

Global variables are declared and defined outside any function in the program. They hold their values throughout the lifetime of the program and are accessible throughout its execution. When we use our non-constant global variable in our programs, it becomes harder to manage. So, it is better to use local ... Read More

1 2 3 4 5 ... 19 Next