Tapas Kumar Ghosh has Published 226 Articles

What is a null-terminated string in C/C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 13-Jun-2025 14:11:53

11K+ Views

In C, the strings are basically array of characters. In C++ the std::string is an advancement of that array. There are some additional features with the traditional character array. The null terminated strings are basically a sequence of characters, and the last element is one null character (denoted by '\0'). ... Read More

Function overloading and const keyword in C++

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 13-Jun-2025 14:02:47

616 Views

In C++, function overloading and const keyword are used for different purposes. Function overloading provides different ways to call a function with different parameter types that make the program more readable. While the const keyword provides the ways of declaration such as variable, member variable, function parameters, member function, and ... Read More

Printing the correct number of decimal points with cout in C++

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 11-Jun-2025 17:19:27

16K+ Views

When working with floating-point numbers in C++, it's important to know how to control the number of decimal places displayed in the output. By default, cout may not always print the expected number of digits after the decimal point.How to Print Correct Number of Decimal Points with cout?To display numbers ... Read More

How to initialize const member variable in a C++ class?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 11-Jun-2025 16:42:41

17K+ Views

A const member variable in a C++ class is a data member whose value must be initialized during object construction and cannot be modified. Initializing Const Member Variable in C++ Class The const member variable must be initialized. To initialize a const member variable, you can use a member initializer ... Read More

How to use POSIX semaphores in C language

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 11-Jun-2025 14:42:30

2K+ Views

The POSIX stands for Portable Operating System which was developed by IEEE (Institute of Electrical and Electronics Engineers). This is UNIX based operating system that is used for both system calls and library functions. The semaphores are used in the process of multithreading and synchronization. For eg. file sharing and ... Read More

How to check if a variable is NULL in C/C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 11-Jun-2025 14:20:52

26K+ Views

In C/C++, there is no special method for comparing NULL values. We can use if statements to check whether a variable is null or not.Here, we will attempt to open a file in read mode that does not exist on the system. In this case, the function will return a ... Read More

isalpha() and isdigit() in C/C++

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 09-Jun-2025 14:48:51

39K+ Views

Both isalpha() and isdigit() are the part of C/C++ library function which can be used to check whether a given character is an alphabetical letter or a digit, respectively. These fuctions accept the given character/digit as input and determine the presence of letter or digit in correct/incorrect form. What is ... Read More

C++ Program to Check Whether a Number can be Expressed as Sum of Two Prime Numbers

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 09-Jun-2025 11:28:29

1K+ Views

You are given a number and you need to write a C++ program to check whether a number can be expressed as sum of two prime numbers. Input / Output Scenarios Following is the input-output statement: Input: n = 19 Output: 19 can be expressed as the sum of two ... Read More

C++ program to Zoom digits of an integer

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 09-Jun-2025 11:25:27

236 Views

Zooming digits means printing the digits of a given number in an enlarged form using special characters. In this article, we will learn to print (display) enlarged (zoomed) form of the digits of a given number. Below is the representation of digits 01438 in zoom format, Example of Zoom ... Read More

Precision of floating point numbers in C++ (floor(), ceil(), trunc(), round() and setprecision())

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 06-Jun-2025 19:32:33

8K+ Views

Precision of floating point numbers is the accuracy upto which a floating point number can hold the values after decimal. For example, 10/6 = 1.6666666… these have recurring decimals which can take infinite memory spaces to be stored. To avoid memory overflow in such cases the compiler set a precision ... Read More

Advertisements