当前位置:网站首页>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
}
}
边栏推荐
- TX Text Control 30.0 ActiveX
- February 19 CTF exercise
- Specific operations for uploading pictures in PHP
- Small sample learning data set
- Ranorex Studio 10.1 Crack
- DOM document object model (I)
- Baidu ueeditor set toolbar initial value
- Using JS to realize the sidebar of life information network
- Redis (17)
- Laravel Vonage SMS sending
猜你喜欢

Essais de pénétration - sujets d'autorisation

The construction and usage of wampserver framework

dotnet-exec 0.4.0 released

Rce code execution & command execution (V)

API interface management setup -eolinker4.0

Wechat applet new version prompt update

Small sample learning data set

基于SSH实现的学生成绩管理系统

HR took the initiative to raise the salary of the test lady. How did she do it?

In depth understanding of line height and vertical align
随机推荐
The article is on the list. Welcome to learn
Professional things use professional people
Summary of SQL injection (I)
Apache+php uploading large files
A review of small sample learning
File upload vulnerability (III)
Go deep into the working principle of browser and JS engine (V8 engine as an example)
Laravel Vonage SMS sending
Array: force deduction dichotomy
Bind simulation, key points of interpreting bind handwritten code [details]
TX Text Control 30.0 ActiveX
[image fusion] image fusion based on MATLAB directional discrete cosine transform and principal component analysis [including Matlab source code 1907]
Route parameters to jump to the page and transfer parameters -- > hidden parameter list
A brief talk on media inquiry
How to install the blue lake plug-in to support Photoshop CC 2017
Click to jump out and drag the pop-up window
parallel recovery slave next change & parallel recovery push change
CTFHUB SSRF
Attack and defense world web baby Web
How PHP gets the user's City