Difference between unsigned char * and char *

Source: Internet
Author: User

The program defines the unsigned char * length. No, I want to ask why it should be defined as an unsigned char *. What is the difference between the unsigned char * and the data type defined by char? Generally, unsigned char * points to what data type, and char * points to what data type?

Unsigned char * is a data type pointing to unsigned char.
Char * is a data type pointing to the char type. All common characters can be seen that char * points to the string, while unsigned char * points to the hex.
In fact, there is no difference between them. Because no visible characters are negative.

 

There are actually differences, such as unsigned char test [] = {0xff}; printf ("% 02x", test [0]);

Char test [] = {0xff}; printf ("% 02x", test [0]); results are different. Differences between the unsigned number and the signed number

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.