-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharrayTOfunctions.c
53 lines (34 loc) · 941 Bytes
/
arrayTOfunctions.c
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
42
43
44
45
46
47
48
49
50
51
52
53
#include<stdio.h>
// void printarray(int *p , int n){
// for(int i=0; i<n;i++){
// printf("\n%d element is : %d",i+1,*p);
// p++;
// }
// }
// OR
// void printarray(int p[] , int n){
// for(int i=0; i<n;i++){
// printf("\n%d element is : %d",i+1,*p);
// p++;
// }
// }
// OR
// void printarray(int p[] , int n){
// for(int i=0; i<n;i++){
// printf("\n%d element is : %d",i+1,*(p+i));
// }
// }
// OR
void printarray(int p[] , int n){
for(int i=0; i<n;i++){
printf("\n%d element is : %d",i+1,p[i]);
}
}
int main(){
int array[]={3,4,2,1,3,4,5};
// By these 2 ways , we can pass array to functions
// printarray(&array[0],7);
// OR
printarray(array,7); // By default , address of first element of array will pass
return 0;
}