[C] Language (pointer) number priority two

Principle is not talked about, here to understand how to use the pointer

Code 1:

#include <stdio.h>
 int main () 
{ 
    int A, B; / * actual declared variables * / 
    int * P, Q *; / * pointer variable declaration * / 
    P = & A; / * pointer variable address storing real variables * / 
    Q = & B; 
    scanf_s ( " % D% D " , P, Q);
     IF (* P> = * Q) 
    { 
        int T = * P;
         * P = * Q;
         * Q = T; 
    } 
    the printf ( " % D% D \ n- " , P *, * Q); 
}

 Code 2:

#include <stdio.h>
 int main () 
{ 
    int A, B; / * actual declared variables * / 
    int * P, Q *; / * declaration pointer variable * / 
    int * T = new new  int ; / * new new int randomly generates an integer space, must be added to this otherwise error * / 
    P = & a; / * pointer variable address stored real variables * / 
    Q = & B; 
    scanf_s ( " % D% D " , P, Q );
     IF (P *> * = Q) 
    {
         * = T * P;
         * = P * Q;
         * = Q *  T;
    }
    printf("%d %d\n",*p,*q);
}

 

Guess you like

Origin www.cnblogs.com/HGNET/p/11971689.html