Tapas Kumar Ghosh has Published 226 Articles

Implement your own sizeof operator using C++

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 21-Apr-2025 18:00:20

953 Views

In C++, the sizeof() operator is a unary operator which is used to calculate the size of any data type. Implementing sizeof() OperatorWe can use the #define directive to implement a macro that copies the behavior of the sizeof() operator for objects, though it will not be the same as ... Read More

Swap two variables in one line in C/C+

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 14-Apr-2025 18:23:50

1K+ Views

In C++, swapping two variables means exchanging the values stored in them. There can be multiple ways to implement the swapping using single line statement. In this article, we are going to learn some of the approaches to swap the values. Example Let's consider the following example with input and ... Read More

What should main() return in C and C++?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 14-Apr-2025 18:00:03

3K+ Views

In C/C++, the main() function is used in the beginning of every program. This returns the program execution status in the operating system. Syntax Following is the syntax of the main() function using C/C++: int main(void); int main(int argc, char *argv[]); Example Below, the C/C++ example shows the usage ... Read More

Convert a C++ String to Upper Case

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 11-Apr-2025 18:26:32

809 Views

In C++, converting a string into uppercase means changing all the characters into uppercase. This is a common requirement in many applications, such as formatting output, standard data input, and case sensitivity. Following is the table that shows the conversion of string to uppercase: ... Read More

Proof that travelling salesman problem is NP Hard

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 11-Apr-2025 18:22:50

5K+ Views

The Traveling Salesman Problem (TSP) involves a salesman who must start at a given location, visit every other city exactly once, and then return to the starting point. The goal of TSP is to find the shortest path that minimizes the total distance traveled. Travelling Salesman Problem : NP−Hard ... Read More

What is the size of void pointer in C/C++ ?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 11-Apr-2025 18:20:24

8K+ Views

The size of void pointer varies system to system. If the system is 16-bit, size of void pointer is 2 bytes. If the system is 32-bit, size of void pointer is 4 bytes. If the system is 64-bit, size of void pointer is 8 bytes. Finding Size of a Void ... Read More

C++ Program to Convert Octal Number to Binary Number

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 11-Apr-2025 18:14:50

1K+ Views

In a computer system, the binary number is expressed in the binary numeral system while the octal number is in the octal numeral system. The binary number is in base 2 while the octal number is in base 8. Here, we provide the tabular data to understand binary numbers and ... Read More

C++ Program to Implement Variable Length Array

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 09-Apr-2025 19:05:12

7K+ Views

Variable length arrays can have a size as required by the user i.e they can have a variable size. A Variable−Length Array (VLA) is an array whose length is determined at runtime (not compile-time). Variable Length Array Using Vector A vector is defined by the resizable array that is ... Read More

C++ Program to Implement Parallel Array

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 09-Apr-2025 19:02:54

5K+ Views

A parallel array is a structure that contains multiple arrays. Each of these arrays are of the same size and the array elements are related to each other. All the elements in a parallel array represent a common entity. Here, we provide the basic example to understand the parallel array ... Read More

How to set up pygame with Eclipse?

Tapas Kumar Ghosh

Tapas Kumar Ghosh

Updated on 27-Feb-2025 17:36:56

348 Views

The pygame is the name of the module of Python that helps to build the code for graphics such as rectangles, squares, circles, etc. It is also used the write the code for animation programs in Python. Eclipse is famous for Java IDE but here we have to set the ... Read More

Previous 1 ... 6 7 8 9 10 ... 23 Next
Advertisements