zoukankan      html  css  js  c++  java
  • 指针数组与数组指针

    指针数组就是存储指针的数组,数组指针就是指向数组的存储。

    使用实例如下:

    #include<stdio.h>
    void main()
    {
        //数组指针的使用
        int s[3][4] = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 } };
        int(*p)[4] = s;//数组指针
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                printf("%d	", *(*(p + i))+j);//数组指针的使用
            }
            printf("
    ");
        }
        //指针数组的使用
        char * t[] = { "Hello", "nihao", "C" };
        for (int i = 0; i < 3; i++)
        {
            puts(t[i]);
        }
        getchar();
    }
  • 相关阅读:
    Android随笔
    Android随笔
    Android随笔
    Android随笔
    Android随笔
    Android随笔
    Android随笔
    Android随笔
    Android随笔
    Codeforces Round #551题解
  • 原文地址:https://www.cnblogs.com/JsonZhangAA/p/5242418.html
Copyright © 2011-2022 走看看