jeudi 24 novembre 2016

How to make this initialization legal in C++?

I'va seen an excersise in a book, but I cannot figure out the answer:

Is the following code legal or not? If not, how might you make it legal?

int null = 0, *p = null;

Of course, the second one is not legal, you cannot convert int to int*.

The theme was in the section the constexpr.

Aucun commentaire:

Enregistrer un commentaire