当前位置:网站首页>Pointer array function combination in C language
Pointer array function combination in C language
2022-06-25 05:14:00 【Distant Aoki】
#include<stdio.h>
void initarray(int *array,int size)
{
int i;
for(i=0;i<size;i++)
{
printf(" Please enter the first %d Data :\n",i+1);
scanf("%d",array); // Or it can be written as scanf("%d",array++);
array++;
}
}
void printarray(int *array,int size)
{
int i;
for(i=0;i<size;i++)
{
printf("%d\n",*array);// Or it can be written as scanf("%d",*array++);
array++;
}
}
int main()
{
int array[5];
int size=sizeof(array)/sizeof(array[0]);
initarray(array,size);// The actual parameter is the first address of the array , The array name represents the address of the first element
printarray(&array[0],size);
return 0;
}
/* Mixed writing of pointer and array name :
1、 Pointer as array name , Subscript access
2、 Add... To the array name
3、 You can't array++,sizeof Time pointer variables occupy eight bytes
/* for example
int main()
{
int array[3]={1,2,3};
int *p=array;
for(i=0;i<3;i++)
{
printf("%d",p[i]);1、 Pointer as array name , Subscript access
}
for(i=0;i<3;i++)
{
printf("%d",*(array+i));1、 Array name plus
}
}
边栏推荐
- Use serialize in egg to read and write split tables
- Basic knowledge of web pages (URL related)
- The print area becomes smaller after epplus copies the template
- CUDA compilation error
- 投资理财产品的年限要如何选?
- TeeChart Pro ActiveX 2022.1
- Personalized Federated Learning with Moreau Envelopes
- The construction and usage of wampserver framework
- Native JS high risk reminder pop-up code snippet, "are you sure you want to do this?" and "it cannot be recovered after deletion. Do you want to continue“
- Dynamic programming example 2 leetcode62 unique paths
猜你喜欢

dotnet-exec 0.4.0 released

Summary of SQL injection (I)

Detailed summary of float

Working principle of asemi three-phase rectifier bridge

渗透测试-目录遍历漏洞

Ctfhub eggs

两小时带你进入软件测试行业风口(附全套软件测试学习路线)

hr竟主动给这位测试小姐姐涨工资,她是怎么做到的?

XSS (cross site script attack) summary (II)
![[image fusion] image fusion based on MATLAB directional discrete cosine transform and principal component analysis [including Matlab source code 1907]](/img/a1/f7a35a04e180e89d7f2fdbf89c1160.jpg)
[image fusion] image fusion based on MATLAB directional discrete cosine transform and principal component analysis [including Matlab source code 1907]
随机推荐
How to open the DWG file of the computer
A review of small sample learning
Deeply understand the characteristics of standard flow and off standard elements
Apache+php uploading large files
【FLink】access closed classloader classloader. check-leaked-classloader
Difference between asemi high power FET and triode
SRC platform summary
Electronic Society C language level 1 28, character diamond
Even if you are not good at anything, you are growing a little bit [to your 2021 summary]
投资理财产品的年限要如何选?
dotnet-exec 0.4.0 released
Flex flexible layout for mobile terminal page production
The construction and usage of wampserver framework
How micro engine uploads remote attachments
On Transform
Professional things use professional people
Five simple data types of JS
Understand JS high-order function and write a high-order function
Read the general components of antd source code
epplus复制模板后打印区域变小的问题