指针数组和数组指针的区别以及main函数

1.C语言中的数组有自己特定的类型

2.数组的类型有元素类型和数组大小共同决定

3.C语言中通过typedef为数组类型重命名

typedef type(name)[size];

                        数组指针

1.数组指针用于指向一个数组

2.数组名是数组首元素的起始地址,但并不是数组的起始地址

3.通过将取地址符&作用于数组名可以得到数组的起始地址

4.可通过数组类型定义数组指针:

ArrayType* pointer;

5.也可以直接定义:type (*pointer)[n];pointr为数组指针变量名,type为指向的数组的类型;n为指向的数组的大小。

说白了数组指针就是数组的第一个元素的地址,就是一个指针,只不过这个指针是const指针,只读。

#include <stdio.h>typedef int(AINT5)[5];typedef float(AFLOAT10)[10];typedef char(ACHAR9)[9];//定义了3个数组类型int main(){    AINT5 a1;    float fArray[10];    AFLOAT10* pf = &fArray;//AFLOAT10是数组类型,    ACHAR9 cArray;    char(*pc)[9] = &cArray;    char(*pcw)[4] = cArray;        int i = 0;        printf("%d, %d\n", sizeof(AINT5), sizeof(a1));        for(i=0; i<10; i++)    {        (*pf)[i] = i;    }        for(i=0; i<10; i++)    {        printf("%f\n", fArray[i]);    }        printf("%0X, %0X, %0X\n", &cArray, pc+1, pcw+1);}

指针数组

1.指针数组是一个普通的数组

2.指针数组中每个元素为一个指针

3.数组指针的定义:type* pArray[n];type*为数组中每个元素的类型;parray为数组名;n为数组大小

说白了就是一个数组,里面的元素全都是指针类型的。


main函数

1.main函数可以理解为操作系统调用的函数

2.在执行程序的时候可以向main函数传递参数

#include <stdio.h>int main(int argc, char* argv[], char* env[])/*命令行参数的个数,命令行参数数组,环境变量数组*/{    int i = 0;        printf("============== Begin argv ==============\n");        for(i=0; i<argc; i++)    {        printf("%s\n", argv[i]);    }        printf("============== End argv ==============\n");        printf("\n");    printf("\n");    printf("\n");        printf("============== Begin env ==============\n");        for(i=0; env[i]!=NULL; i++)    {        printf("%s\n", env[i]);    }        printf("============== End env ==============\n");}
main(int argc,char *argv){  while(argc-->1)      printf("%s",*++argv);}

argc代表的是系统自动获取命令的个数,char *argv代表指针数组,argc-->1表示,先和1比较,然后在自减.

总结:

  1. 数组指针本质上是一个指针

  2. 数组指针指向的值是数组的地址

  3. 指针数组本质上是一个数组

  4. 指针数组中每个元素的类型是指针

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
QCC5125 VFBGA is a system on-chip (SoC) with on-chip Bluetooth, audio and programmable application processor. It includes high-performance, analog, and digital audio codecs, Class-AB and Class-D audio drivers, advanced power management, Li-ion battery charger, light-emitting diode (LED) drivers, and flexible interfaces including interintegrated circuit sound (I²S), inter-integrated circuit interface (I²C), universal asynchronous receiver transmitter (UART), and programmable input/output (PIO). An application-dedicated Developer Processor and a system Firmware Processor run code from an external quad serial peripheral interface (QSPI) flash. Both processors have tightly coupled memory (TCM) and an on-chip cache for performance while executing from external flash memory. The system Firmware Processor provides functions developed by Qualcomm Technologies International, Ltd. (QTIL). The Developer processor provides flexibility to the product designer to customize their product. The Audio subsystem contains a programmable Kalimba core running Qualcomm® Kymera™ system DSP architecture framework from read only memory (ROM). A range of audio processing capabilities are provided from ROM which are configurable in fully flexible audio graphs. In built capabilities in ROM, may be complimented or replaced by capabilities run from random access memory (RAM), including those provided by QTIL, the product designer or third parties. The flexibility provided by the fully programmable applications processor plus the ability to configure and program the audio processors enables manufacturers to easily differentiate products with new features. QCC5125 VFBGA is driven by a flexible, software platform with powerful integrated development environment (IDE) support. This enables rapid time-to-market deployment for a broad range of consumer electronic products, including audio, wireless speaker, Qualcomm TrueWireless, and broadcast audio for stereo speaker arrangements.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值