Karthikeya Boyini has Published 2193 Articles

Initialization of variable sized arrays in C

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 08:59:10

7K+ Views

Variable sized arrays are data structures whose length is determined at runtime rather than compile time. These arrays are useful in simplifying numerical algorithm programming. The C99 is a C programming standard that allows variable sized arrays.A program that demonstrates variable sized arrays in C is given as follows −Example Live ... Read More

Python Program to calculate the Round Trip Time (RTT)

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 08:56:00

2K+ Views

Here we will see how Python can be used to get the Round Trip Time (RTT). The RTT is the time which is taken by the entire trip of a signal. It means the time between the starting time when a signal is sent and the receiving time of the ... Read More

Convert double primitive type to a Double object in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 08:52:45

8K+ Views

To convert double primitive type to a Double object, you need to use Double constructor.Let’s say the following is our double primitive.// double primitive double val = 23.78;To convert it to a Double object, use Double constructor.// Double object Double ob = new Double(val);Example Live Demopublic class Demo {    public ... Read More

Double isNaN() method in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 08:51:15

184 Views

The java.lang.Double.isNan() method returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.Let’s say the following are our Double values.Double val1 = new Double(3/0.); Double val2 = new Double(0/0.);Now, we will use the isNan() method to check whether the number is a NaN or not.val1.isNaN(); val2.isNaN()The following ... Read More

Check two float arrays for equality in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 08:45:58

181 Views

To check two float arrays for equality, use the Arrays.equals() method.In our example, we have the following two float arrays.float[] floatVal1 = new float[] { 3.2f, 5.5f, 5.3f }; float[] floatVal2 = new float[] { 3.2f, 5.5f, 5.3f };Let us now compare them for equality.if (Arrays.equals(floatVal1, floatVal2)) { System.out.println("Both are ... Read More

Initialization of static variables in C

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 08:45:18

5K+ Views

When static keyword is used, variable or data members or functions can not be modified again. It is allocated for the lifetime of program. Static functions can be called directly by using class name.Static variables are initialized only once. Compiler persist the variable till the end of the program. Static ... Read More

Java Program to display previous day from GregorianCalender

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 08:36:23

423 Views

For GregorianCalendar class, import the following package.import java.util.GregorianCalendar;Create an object.GregorianCalendar cal = (GregorianCalendar) GregorianCalendar.getInstance();Now, use the following field and add() method with a negative one (-1) to display the previous day.cal.add((GregorianCalendar.DATE), -1)Example Live Demoimport java.util.Calendar; import java.util.GregorianCalendar; public class Demo {    public static void main(String[] a) {       ... Read More

strftime() function in C/C++

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 08:36:22

733 Views

The function strftime() is used to format the time and date as a string. It is declared in “time.h” header file in C language. It returns the total number of characters copied to the string, if string fits in less than size characters otherwise, returns zero.Here is the syntax of ... Read More

Display weekday names in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 08:34:35

482 Views

To display weekday names in Java, use the getWeekdays() method.For that, firstly import the following package.import java.text.DateFormatSymbols;Now, create a string array and get all the weekday names using the getWeekdays() method.String[] weekDays = new DateFormatSymbols().getWeekdays();Example Live Demoimport java.text.DateFormatSymbols; public class Demo {    public static void main(String[] args) {     ... Read More

pow() function in C

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 08:33:04

7K+ Views

The function pow() is used to calculate the power raised to the base value. It takes two arguments. It returns the power raised to the base value. It is declared in “math.h” header file.Here is the syntax of pow() in C language, double pow(double val1, double val2);Here, val1 − The ... Read More

Advertisements