Questions tagged [nullptr]

The C++11 keyword for a null pointer, it can be converted to any pointer type. Also available in C23 through stddef.h. Always use this tag either in combination with the C++ or the C tag.

In C++, nullptr is a null pointer constant of type std::nullptr_t which can be implicitly converted to any pointer type. An integer constant 0 can also be converted to any pointer type but can also be deduced as an integer in other contexts, leading to ambiguities. See What exactly is nullptr?

In C ("C23" ISO 9899:202x), nullptr is similarly a null pointer constant of type nullptr_t found in stddef.h. It can get converted to a void*, bool or a pointer type.

349 questions
-5
votes
1 answer

What to use as end() iterator C++?

i made an array of pointers to some struct called element. So after i make an table** i just set every pointer in array to null pointer and then later on i add elements. Now when i iterate i can't set my end() as null pointer because then it will…
-5
votes
1 answer

Singly Linked List assign issue (nullptr)

what's wrong with this simple Linked List ? // linked_lst1.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include using namespace std; class Node { int data; Node* next; friend class…
user7868540
-9
votes
1 answer

template program crashing during execution

I'm implementing Doubly Linked List in C++, using templates. As I'm trying my hands on templates. template class DList{ Node *head; Node *tail; public: Dlist(){ head = tail = nullptr; } …
1 2 3
23
24