The difference between void * pointer and null pointer in C language

Source: Internet
Author: User

Void* This is not called a null pointer, which is called a pointer with no exact type. This pointer points to a piece of memory, but does not tell the program which way to interpret the memory. So this type of pointer does not directly take the action of the content. You must first turn to another type of pointer before you can interpret the content.

There is also ' a ', which is not what the null pointer refers to. ' \ s ' means the end of a string, not null.

The real null pointer is that the pointer does not point to a piece of meaningful memory, such as:
char* K;
Here the k is called a null pointer. We didn't let it point to any place.
Or
char* k = NULL;
Here the k is also called null pointer, because it points to null, which is 0, note is the integer 0, not '
A null pointer and we cannot take the content operation on it.
A null pointer can only be taken to content if it really points to a meaningful memory. That's what it is.
k = "Hello world!";
At this point k is not a null pointer.

The difference between void * pointer and null pointer in C language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.