mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 23:18:48 +00:00
Reorganize tests
This commit is contained in:
19
examples/c/array.c
Normal file
19
examples/c/array.c
Normal file
@@ -0,0 +1,19 @@
|
||||
int sum(int len, int *p) {
|
||||
int result = 0;
|
||||
for (int i = 0; i < len; i++) {
|
||||
result += p[i];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int main() {
|
||||
int a[5];
|
||||
int len = 5;
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
a[i] = i;
|
||||
}
|
||||
|
||||
return sum(len, a) == 10;
|
||||
}
|
||||
Reference in New Issue
Block a user