150312--Start learning pointers

Source: Internet
Author: User

  • The introduction of pointer learning is still the process of exchanging two numeric values, which is mentioned in almost every book:
    1#include <stdio.h>2 voidInterchange (int*m,int*n);3 intMain ()4 {5     intx=1, y=3;6     7Interchange (&AMP;X,&AMP;Y);//transferring addresses to functions8printf"x=%d,y=%d\n", x, y);9     return 0;Ten          One }  A  - voidInterchange (int*m,int*N) - { the     inttemp; -      -temp=*m; -*m=*N; +*n=temp; -}

    The pointer p is a variable with a numeric address, and *p is the value stored in the address indicated by the pointer.

The above procedure solves the problem that return cannot return two quantities at the same time without using pointers.

150312--Start learning pointers

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.