Assign NULL pointer

Description

NULL is a constant defined in the standard library and is the equivalent of zero for a pointer. NULL is guaranteed not to point to any location in memory.

Example


#include <stdio.h>
//from   w w w.j  a  va 2  s.  c  o  m
int main(void)
{
  int number = 0;                 
  int *pointer = NULL;            

  number = 10;
  printf("\nnumber's address: %p", &number);            /* Output the address */
  printf("\nnumber's value: %d\n\n", number);           /* Output the value   */

  return 0;
}

The code above generates the following result.





















Home »
  C Language »
    Language Advanced »




File
Function definition
String
Pointer
Structure
Preprocessing