Karthikeya Boyini has Published 2264 Articles

vector::resize() vs vector::reserve() in C++

karthikeya Boyini

karthikeya Boyini

Updated on 06-May-2025 17:31:12

830 Views

Vectors have the ability to resize itself automatically like dynamic arrays when an element is inserted or deleted, the container handle their storage automatically. The main difference between vector resize() and vector reserve() is that resize() is used to change the size of vector where reserve() doesn’t. reserve() is only ... Read More

How to sum two integers without using arithmetic operators in C/C++?

karthikeya Boyini

karthikeya Boyini

Updated on 29-Apr-2025 18:59:46

262 Views

Given are the two integer variables, a and b. To calculate the sum without using any arithmetic operators such as + or -. We can achieve this by using bitwise operations, which allow us to calculate the sum. Here, we have some approaches in C and C++ to solve this ... Read More

C/C++ program to make a simple calculator?

karthikeya Boyini

karthikeya Boyini

Updated on 14-Feb-2025 18:07:39

1K+ Views

A simple calculator allows the user to perform basic math operations like addition, subtraction, multiplication, and division . The user inputs two numbers and selects an operation. For example, if the user enters 4 and 3, then selects the "+" operation, the calculator will perform addition and output the ... Read More

Java Program to extend the size of an Integer array

karthikeya Boyini

karthikeya Boyini

Updated on 10-Feb-2025 11:32:23

279 Views

In this article, we will learn how to extend the size of an Integer array in Java. We will see how to create a new array with an extended size and copy the existing array elements into it. What is an array? An array is a data structure that holds ... Read More

Get the union of two sets in Java

karthikeya Boyini

karthikeya Boyini

Updated on 28-Jan-2025 14:55:40

6K+ Views

The union of two sets combines all the unique elements from both sets into one. In Java we can achieve this using the HashSet class, which ensures no duplicate elements. This article will demonstrate two approaches to finding the union of two sets.  Different Approaches  Following are the two different approaches to ... Read More

Java Program to convert a String to a float type Number

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jan-2025 22:54:22

200 Views

In this article, we will learn how to convert a string to a float-type number in Java. We will use the Float.parseFloat() method to perform this conversion. Float.parseFloat() method The Float.parseFloat() method belongs to the Float class in Java and is used to convert a string representation of a number ... Read More

Java Program to display Frame after some seconds

karthikeya Boyini

karthikeya Boyini

Updated on 02-Jan-2025 19:13:28

357 Views

In this article, we will learn how to display a frame after a few seconds in Java using the Timer class. This example shows how to delay the visibility of a frame by 2 seconds using Swing. Timer() class The Timer class is used to schedule tasks that execute after ... Read More

Java program to convert a Map to a read only map

karthikeya Boyini

karthikeya Boyini

Updated on 31-Dec-2024 22:00:07

318 Views

A read-only map in Java is a type of Map that cannot be modified after it has been created. This means that once the map has been set to be read-only, we cannot add, remove, or update any of the key-value pairs.Converting a Map to a read only map We ... Read More

Java Program to convert from a java.util.Date Object to a java.sql.Date Object

karthikeya Boyini

karthikeya Boyini

Updated on 23-Dec-2024 18:06:23

608 Views

In this article, we will learn to convert a java.util.Date object to a java.sql.Date object in Java. This is a common requirement when working with databases, as many database systems use the java.sql.Date class to represent date values. While java.util.Date is used for general date and time representation in Java, ... Read More

strdup() and strdndup() in C/C++

karthikeya Boyini

karthikeya Boyini

Updated on 03-Dec-2024 09:44:41

7K+ Views

strdup() The function strdup() is used to duplicate a string. It returns a pointer to a null-terminated byte string. Syntax Here is the syntax of strdup() in C language, char *strdup(const char *string); Example Here is an example of strdup() in C language. #include #include int main() {  char ... Read More

1 2 3 4 5 ... 227 Next
Advertisements