C language introduction tutorial -18 Pointers

A pointer has only one purpose: to point to an address. Address, is the computer memory address, used to identify the location of memory.

#include <stdio.h>
 
int main (a)
{
    int a = 10;
    int *p;              // Define pointer variables
    p = &a;				//p refers to the address of a, &a is to fetch the address
 
   printf("*p value: %d\n", *p ); *p can get the value of the address p points to.


   printf("Address of variable A: %p\n", p);
   return 0;
}
Copy the code

Pointers should be one of the most difficult parts of C, not something that can be explained in a few words. Xiaobian will not expand the explanation here.

Write at the end:

This tutorial is to write some more commonly used, and more basic knowledge points. Help you quickly start c language, as to want to become a god, or need a thick tutorial, carefully study every word, and then write code in the compiler above. Because programming ability is something you can toss around, not learn from any tutorial.