Chandu yadav has Published 1163 Articles

Data Types we cannot use to create array in C

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 14:11:13

294 Views

An array can be created using all data types such as int, char, float, double etc. But creating an array by using the void data type is not possible. An error will be displayed if that is done.A program that demonstrates this is given as follows.Example Live Demo#include #include ... Read More

Calling a member function on a NULL object pointer in C++

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 13:47:22

863 Views

A class member function can be called using a NULL object pointer.Note − This is undefined behaviour and there is no guarantee about the execution of the program. The actual results depend on the compiler used.A program that demonstrates this is given as follows.Example Live Demo#include using namespace std; class ... Read More

When should you use a class vs a struct in C++?

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 13:36:53

323 Views

Structures and classes are very similar in C++ except for some differences. So details about these differences are given below that help to decide when to use a class or structure in C++.Differences between Class and StructureAll the members of a class are private by default. This is different compared ... Read More

Accessing protected members in a C++ derived class

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 13:30:35

17K+ Views

A class in C++ has public, private and protected sections which contain the corresponding class members. Protected members in a class are similar to private members as they cannot be accessed from outside the class. But they can be accessed by derived classes or child classes while private members cannot.A ... Read More

Can main function call itself in C++?

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 13:24:19

1K+ Views

The main() function can call itself in C++. This is an example of recursion as that means a function calling itself. A program that demonstrates this is given as follows.Example Live Demo#include using namespace std; int main() {    static int x = 1;    cout

Select into in MySQL?

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 13:12:11

1K+ Views

To do select into in MySQL, use CREATE TABLE SELECT command. The syntax is as follows −CREATE TABLE yourTableName SELECT *FROM yourOriginalTableName;To understand, let us first create a table −mysql> create table SelectIntoDemo -> ( -> Id int, -> Name varchar(200) -> ); Query OK, 0 rows affected (0.50 sec)Let ... Read More

Error-Detecting Codes - Cyclic Redundancy Checks (CRCs)

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 13:08:57

6K+ Views

Errors and Error DetectionWhen bits are transmitted over the computer network, they are subject to get corrupted due to interference and network problems. The corrupted bits leads to spurious data being received by the receiver and are called errors.Error detection techniques are responsible for checking whether any error has occurred ... Read More

How to insert current date/time in MySQL?

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 12:53:52

5K+ Views

To insert current date/ time in MySQL, use the now() function. Let us now see an example.At first, we will create a table. The CREATE command is used to create a table.mysql > create table CurrentDateTime -> ( -> CurrentTime datetime -> ); Query OK, 0 rows affected (1.14 sec)Syntax ... Read More

Is it possible to use UPDATE query with LIMIT in MySQL?

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 12:30:35

8K+ Views

Yes, it is possible to use UPDATE query with LIMIT in MySQL. Let us see how.For our example, we will first create a table. The CREATE command is used to create a table.mysql>CREATE table tblUpdateLimit -> ( -> id int, -> name varchar(100) -> ); Query OK, 0 rows affected ... Read More

How to escape single quotes in MySQL?

Chandu yadav

Chandu yadav

Updated on 26-Jun-2020 12:24:56

469 Views

We can escape single quotes with the help of the SELECT statement. For instance, when single quotes are encountered in a name, eg. “Carol’s”.Let us see the syntax.SELECT ‘SomeValue’;Here is an example that display how to include text with single quotes.mysql> SELECT 'Carol\'s Taylor.'; The following is the output.+-------------------+ | ... Read More

Advertisements