FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
C-array-lab/array.c at main · HasibCoderLab/C-array-lab · GitHub
HasibCoderLab
/
C-array-lab
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
C-array-lab
/
array.c
Copy path
More file actions
More file actions
Latest commit
History
History
History
133 lines (102 loc) · 2.32 KB
Breadcrumbs
C-array-lab
/
array.c
Copy path
File metadata and controls
133 lines (102 loc) · 2.32 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// ================================================
// * Language: C
// * Topic: Array
// ===============================================
// example 1️⃣
#include
<stdio.h>
int
main
(){
int
marks
[
3
];
printf
(
"Phy : "
);
scanf
(
"%d"
,
&
marks
[
0
]);
printf
(
"Chemy : "
);
scanf
(
"%d"
,
&
marks
[
1
]);
printf
(
"Bio : "
);
scanf
(
"%d"
,
&
marks
[
2
]);
printf
(
" Phy = %d Chemy = %d bio = %d\n"
,
marks
[
0
],
marks
[
1
],
marks
[
2
]);
return
0
;
}
// ================== Traverse an array ========
#include
<stdio.h>
int
main
()
{
int
NID
[
5
];
// input
int
*
ptr
=
&
NID
[
0
];
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
printf
(
"%d index = "
,
i
);
// scanf("%d", (ptr + i));
scanf
(
"%d"
,
&
NID
[
i
]);
}
// output
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
// printf("%d index = %d\n", i, *(ptr + i));
printf
(
"%d index = %d\n"
,
i
,
NID
[
i
] );
}
return
0
;
}
// ================== Traverse an array 0.2 Version ========
#include
<stdio.h>
int
main
(){
int
NID
[
5
];
// input
int
*
ptr
=
&
NID
[
0
];
for
(
int
i
=
0
;
i
<
5
;
i
++
){
printf
(
" %d index = "
,
i
);
scanf
(
"%d"
,
&
NID
[
i
]);
}
for
(
int
i
=
0
;
i
<
5
;
i
++
){
printf
(
"%d index = %d\n"
,
i
,
NID
[
i
]);
}
}
#include
<stdio.h>
int
main
(){
return
0
;
}
// ========== function array ===================
#include
<stdio.h>
void
printNumbers
(
int
arr
[] ,
int
n
);
int
main
(){
int
arr
[]
=
{
1
,
2
,
3
,
4
,
5
,
6
,
7
};
printNumbers
(
arr
,
7
);
// function call
return
0
;
}
// function Definition
void
printNumbers
(
int
arr
[] ,
int
n
){
for
(
int
i
=
0
;
i
<
n
;
i
++
){
printf
(
" %d\t"
,
arr
[
i
]) ;
}
printf
(
"\n"
);
}
// ========== function array 2.0 ===================
#include
<stdio.h>
void
printN
(
int
*
arr
,
int
n
);
int
main
(){
int
arr
[]
=
{
12
,
13
,
14
,
15
,
16
,
17
,
1
,
7
};
printN
(
arr
,
8
);
return
0
;
}
void
printN
(
int
*
arr
,
int
n
){
for
(
int
i
=
0
;
i
<
n
;
i
++
){
printf
(
"%d\t"
,
arr
[
i
] );
}
printf
(
"\n"
) ;
}
// 2D array
#include
<stdio.h>
int
main
(){
int
marks
[
2
][
3
];
marks
[
0
][
0
]
=
98
;
marks
[
0
][
1
]
=
99
;
marks
[
0
][
3
]
=
100
;
marks
[
1
][
0
]
=
95
;
marks
[
1
][
1
]
=
96
;
marks
[
1
][
3
]
=
10
;
return
0
;
}
// #include <stdio.h>
// int main(){
// return 0;
// }
// 1️⃣ 2️⃣ 3️⃣ 4️⃣ 5️⃣ 6️⃣ 7️⃣ 8️⃣ 9️⃣ 🔟
Back
|
FazBrowse Home
|
New Git URL