check for dev1650 and some minor polish

This commit is contained in:
Chris Boesch 2023-02-19 17:52:16 +01:00
parent 255e646b94
commit 7d129460cf
6 changed files with 12 additions and 9 deletions

View file

@ -7,9 +7,9 @@ const std = @import("std");
// Take note that this main() definition now returns "!void" rather
// than just "void". Since there's no specific error type, this means
// that Zig will infer the error type. This is appropriate in the
// case of main(), but can make a function harder (function pointers)
// or even impossible to work with (recursion) in some situations.
// that Zig will infer the error type. This is appropriate in the case
// of main(), but can make a function harder (function pointers) or
// even impossible to work with (recursion) in some situations.
//
// You can find more information at:
// https://ziglang.org/documentation/master/#Inferred-Error-Sets

View file

@ -53,8 +53,8 @@ pub fn main() void {
// specify a file descriptor i.e. 2 for error console.
//
// In this exercise we use 'write' to output 17 chars,
// but something is missing...
const c_res = ???write(2, "Hello C from Zig!", 17);
// but something is still missing...
const c_res = write(2, "Hello C from Zig!", 17);
// let's see what the result from C is:
std.debug.print(" - C result ist {d} chars written.\n", .{c_res});

View file

@ -29,5 +29,6 @@ pub fn main() !void {
// Here we call the C function 'fmod' to get our normalized angel.
const result = c.fmod(angel, circle);
// We use formatters for the desired precision and to truncate the decimal places
std.debug.print("The normalized angle of {d: >3.1} degrees is {d: >3.1} degrees.\n", .{ angel, result });
}