/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/zig/zig-520-103-003/main.zig
22 строки
583 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
const std = @import("std"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); const args = try std.process.argsAlloc(allocator); defer std.process.argsFree(allocator, args); if (args.len < 3) { std.debug.print("Использование: zig run calc.zig -- 10 20 30\n", .{}); return; } var total: i64 = 0; for (args[1..]) |raw| { total += try std.fmt.parseInt(i64, raw, 10); } std.debug.print("Сумма: {}\n", .{total}); }