The value of null in C language is 0.

Source: Internet
Author: User

The following is a piece of test code written. With the result tracked by GDB, GDB can even calculate the variable to be tracked before output:

1 # include "stdio. H"
2 int main ()
3 {
4 char * A = NULL;
5
6 if (! A ){
7 printf ("AA \ n ");
8}
9
10
(GDB) B 4
Breakpoint 1 at 0x40052c: file main. C, line 4.
(GDB) S
The program is not being run.
(GDB) r
Starting program:/home/yjbo/temp/main

Breakpoint 1, main () at main. C: 4
4 char * A = NULL;
(GDB) N
6 if (! A ){
(GDB) P
$1 = 0x0
(GDB) P! A
$2 = 1
(GDB) P! A + 1
$3 = 2

 

 

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.