Karthikeya Boyini has Published 2383 Articles

Variable initialization in C++

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 09:12:44

8K+ Views

Variables are the names given by the user. A datatype is also used to declare and initialize a variable which allocates memory to that variable. There are several datatypes like int, char, float etc. to allocate the memory to that variable.There are two ways to initialize the variable. One is ... Read More

Why are global and static variables initialized to their default values in C/C++?

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 09:11:54

3K+ Views

Global and static variables are initialized to their default values because it is in the C or C++ standards and it is free to assign a value by zero at compile time. Both static and global variable behave same to the generated object code. These variables are allocated in .bss ... Read More

Java NumberFormat.getCurrencyInstance() method

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 09:10:36

3K+ Views

The getCurrencyInstance() method of the NumberFormat class returns the instance of the NumberFormat class. The java.text.NumberFormat class is used for formatting numbers and currencies as per a specific Locale. Number formats varies from country to countryHere, we have considered a locale.NumberFormat n = NumberFormat.getCurrencyInstance(Locale.FRANCE);Then, we have formatted a double value ... Read More

Trigonometric methods in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 09:04:16

327 Views

The java.lang.Math class contains methods for performing basic numeric operations such as the trigonometry, logarithm, etc.The following are some of the methods.Sr.NoMethods & Description1static double abs(double a)This method returns the absolute value of a double value.2static float abs(float a)This method returns the absolute value of a float value.3static int abs(int ... Read More

The static keyword and its various uses in C++

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 09:03:47

270 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

Convert a String to a double type number in Java

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 09:00:45

216 Views

To convert a String to a double type number in Java, use the Double.parseDouble() method.Here is our string.String str = "699.7e130";Let us now convert the above string to double.double val = Double.parseDouble(str);Example Live Demopublic class Demo {     public static void main(String args[]) {        String str = "699.7e130";        double val = Double.parseDouble(str);        System.out.println(val);     ... Read More

How to print a variable name in C?

karthikeya Boyini

karthikeya Boyini

Updated on 26-Jun-2020 09:00:16

1K+ Views

The following is an example to print variable name.Example Live Demo#include #define VariableName(name) #name int main() {    int name;    char ch;    printf("The variable name : %s", VariableName(name));    printf("The variable name : %s", VariableName(ch));    return 0; }OutputThe variable name : name The variable name : chIn ... Read More

Compare Two Java double arrays

karthikeya Boyini

karthikeya Boyini

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

141 Views

To compare two Java double arrays, use the Arrays.equals() method. The following are our double arrays.double[] arr1 = new double[] { 1.3, 7.2, 4.2 }; double[] arr2 = new double[] { 1.3, 7.2, 4.2 }; double[] arr3 = new double[] { 2.8, 5.3, 9.8 }; double[] arr4 = new double[] ... Read More

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

Advertisements