-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.cc
More file actions
43 lines (32 loc) · 951 Bytes
/
array.cc
File metadata and controls
43 lines (32 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/***********************************************************************
* @file: array.cc
* @brief: header file
* @history:
* @date:2023-02-28
* @version: v1.1
* @author: pyang
* @contact: [email protected]
* @license: Apache License Version 2.0, 2023 yangp
* @description:
* @Copyright: (C) 2023 .pyang. all right reserved
***********************************************************************/
#include <stdio.h>
#include <iostream>
int main(int argc, char const *argv[])
{
/* code */
int arr[] = {2,4,56,6,8,90};
int count = sizeof(arr)/sizeof(int);
std::cout << "第一种方式循环" << std::endl;
for (size_t i = 0; i < count; i++)
{
printf("%d\n",*(arr+i));
}
std::cout << "第二种方式循环" << std::endl;
for (size_t i = 0; i < count; i++)
{
printf("%d\n",arr[i]);
}
std::cout << "循环结束" << std::endl;
return 0;
}