A character array and a string determine if a blank line is null and the 0 namespace variable needs to be initialized by itself

Source: Internet
Author: User
Tags define null

String can judge a blank line like this
Input! = ""

A character array can be used to determine whether the first element is a null character ' \ s ', or a blank line.
arrar[0]== ' + ';
or with length strlen (char arrar) ==0
Pay special attention to the two
arrar[0]==0;
Arrar[0]==null;
Because pointing to a null pointer, the null pointer points to null,null on the VS This IDE, which represents 0, so the above is established

Null for pointers and objects, 0 for numeric values

In different systems,
Null is not always equal to 0, NULL represents only null, that is, to a non-used address, in most systems, 0 is used as an address, so there is a definition like this
#define NULL 0
This is not always the case, and the system does not use the 0 address as NULL, but instead uses a different address, so don't equate null with 0, especially in some cross-platform code, which will bring you disaster.

The namespace does not initialize the variable like static, and it is initialized by itself.
S.min= (S.min < s.sales[i]? S.min:s.sales[i]);
Cout<<s.min
The output is
To initialize the variable yourself

The variable is placed in an unnamed namespace, much like an internal static variable that is linked, but it cannot be initialized by default.

A character array and a string determine if a blank line is null and the 0 namespace variable needs to be initialized by itself

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.