Anvi Jain has Published 569 Articles

Type difference of character literals in C vs C++

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

186 Views

In C++ the size of the character constants is char. In C the type of character constant is integer (int). So in C the sizeof(‘a’) is 4 for 32bit architecture, and CHAR_BIT is 8. But the sizeof(char) is one byte for both C and C++.Example#include main() {    printf("%d", sizeof('a')); ... Read More

Difftime() C library function

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

174 Views

Here we will see what is the difftime() function in C. The difftime() is used to get the differences between two time values.difftime() takes two time argument, the first one is the lower bound, and the second one is the upper bound. And it returns the differences between these two ... Read More

C++ set for user define data type

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

906 Views

Here we will see how we can make a set for user defined datatypes. The Set is present in C++ STL. This is a special type of data structure, it can store data in sorted order, and does not support duplicate entry. We can use set for any type of ... Read More

Constructor Delegation in C++

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

1K+ Views

Here we will see what is the constructor delegation? When a constructor calls other constructor of the same class, then it is called the constructor delegation. This feature is present from C++11.Let us see the following program, and try to analyze what are the difficulties in this code.Example#include using ... Read More

How to append data from treemap to arraylist for listview in Android?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

233 Views

This example demonstrate about How to append data from tree map to array list for list view in AndroidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code ... Read More

How to compile 32-bit program on 64- bit gcc in C and C++

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

3K+ Views

Nowadays the compiler comes with default 64-bit version. Sometimes we need to compile and execute a code into some 32bit system. In that time, we have to use this feature.At first, we have to check the current target version of the gcc compiler. To check this, we have to type ... Read More

Check the current number of connections to MongoDB?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

820 Views

You can check the current number of connections to MongoDB with the help of the following syntax −var anyVariableName= db.serverStatus(); yourVariableName.connections;The second syntax is as follows −db.serverStatus().connections;To understand both the above syntaxes, let us see them one by one −Case 1 − The first query is as follows −> var ... Read More

Check privileges (grants) for a specific user in MySQL?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

552 Views

If you want to check privileges for a specific user, then use the below syntax −SHOW GRANTS FOR 'yourUserName'@'yourHostName';The above syntax will check privileges for a specific user.To check the privileges for a specific user, then use FOR. Let’s say we have a username ‘JOHN‘ and host is ‘%’. Following ... Read More

Check if a given graph is Bipartite using DFS using C++

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

209 Views

A bipartite graph is a graph in which if the graph coloring is possible using two colors only i.e.; vertices in a set are colored with the same color. This is a C++ program to check whether a graph bipartite or not using DFS.AlgorithmBegin    An array color[] is used ... Read More

How to use cast() in Android sqlite?

Anvi Jain

Anvi Jain

Updated on 30-Jul-2019 22:30:25

431 Views

Before getting into example, we should know what sqlite data base in android is. SQLite is an open source SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation. SQLite supports all the relational database features. In order to ... Read More

Advertisements