27 lines
350 B
Plaintext
27 lines
350 B
Plaintext
struct Point {
|
|
int x;
|
|
int y;
|
|
};
|
|
|
|
fn sum_array(arr: int[]) -> int {
|
|
let mut total = 0;
|
|
foreach (int n in arr) {
|
|
total = total + n;
|
|
}
|
|
return total;
|
|
}
|
|
|
|
fn main() -> int {
|
|
let p: Point;
|
|
let nums: int[];
|
|
let mut x = 1 + 2 * 3;
|
|
p.x = x;
|
|
if (x > 0) {
|
|
x = x + p.x;
|
|
} else {
|
|
x = 0;
|
|
}
|
|
x = sum_array(nums);
|
|
return x;
|
|
}
|