What is uintptr_t data type

uintptr_t is an unsigned integer type that is capable of storing a data pointer. Which typically means that it’s the same size as a pointer. It is optionally defined in C++11 and later standards. A common reason to want an integer type that can hold an architecture’s pointer type is to perform integer-specific operations on a … Read more

(->) arrow operator and (.) dot operator , class pointer

you should read about difference between pointers and reference that might help you understand your problem. In short, the difference is:when you declare myclass *p it’s a pointer and you can access it’s members with ->, because p points to memory location. But as soon as you call p=new myclass[10]; p starts to point to array and when you call p[n] you get a reference, which members … Read more

What is a dangling pointer?

A dangling pointer is a pointer that points to invalid data or to data which is not valid anymore, for example: This can occur even in stack allocated objects: The pointer returned by c_str may become invalid if the string is modified afterwards or destroyed. In your example you don’t seem to modify it, but since it’s … Read more

C pointers and arrays: [Warning] assignment makes pointer from integer without a cast

In this case a[4] is the 5th integer in the array a, ap is a pointer to integer, so you are assigning an integer to a pointer and that’s the warning.So ap now holds 45 and when you try to de-reference it (by doing *ap) you are trying to access a memory at address 45, which is an invalid address, so your program crashes. You should do ap … Read more

What exactly is nullptr?

How is it a keyword and an instance of a type? This isn’t surprising. Both true and false are keywords and as literals they have a type ( bool ). nullptr is a pointer literal of type std::nullptr_t, and it’s a prvalue (you cannot take the address of it using &). 4.10 about pointer conversion says that a prvalue of type std::nullptr_t is a null pointer constant, and that an … Read more