mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-22 14:03:10 -05:00
some improvements in the description
This commit is contained in:
parent
bb95625477
commit
dc187889c1
2 changed files with 8 additions and 8 deletions
|
@ -465,15 +465,15 @@ const exercises = [_]Exercise{
|
||||||
// .output = "ABCDEF",
|
// .output = "ABCDEF",
|
||||||
// .@"async" = true,
|
// .@"async" = true,
|
||||||
// },
|
// },
|
||||||
|
.{
|
||||||
|
.main_file = "092_interfaces.zig",
|
||||||
|
.output = "Daily Insect Report:\nAnt is alive.\nBee visited 17 flowers.\nGrasshopper hopped 32 meters.",
|
||||||
|
},
|
||||||
.{
|
.{
|
||||||
.main_file = "093_hello_c.zig",
|
.main_file = "093_hello_c.zig",
|
||||||
.output = "Hello C from Zig! - C result ist 17 chars",
|
.output = "Hello C from Zig! - C result ist 17 chars",
|
||||||
.C = true,
|
.C = true,
|
||||||
},
|
},
|
||||||
.{
|
|
||||||
.main_file = "092_interfaces.zig",
|
|
||||||
.output = "Daily Insect Report:\nAnt is alive.\nBee visited 17 flowers.\nGrasshopper hopped 32 meters.",
|
|
||||||
},
|
|
||||||
.{
|
.{
|
||||||
.main_file = "999_the_end.zig",
|
.main_file = "999_the_end.zig",
|
||||||
.output = "\nThis is the end for now!\nWe hope you had fun and were able to learn a lot, so visit us again when the next exercises are available.",
|
.output = "\nThis is the end for now!\nWe hope you had fun and were able to learn a lot, so visit us again when the next exercises are available.",
|
||||||
|
|
|
@ -36,11 +36,11 @@
|
||||||
//
|
//
|
||||||
// So that all this does not remain a dry theroy now, let's just start
|
// So that all this does not remain a dry theroy now, let's just start
|
||||||
// and call a C function out of Zig.
|
// and call a C function out of Zig.
|
||||||
//
|
|
||||||
// our well-known "import" for Zig
|
// our well-known "import" for Zig
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
|
||||||
// new the import for C
|
// and here the new the import for C
|
||||||
const c = @cImport({
|
const c = @cImport({
|
||||||
@cInclude("unistd.h");
|
@cInclude("unistd.h");
|
||||||
});
|
});
|
||||||
|
@ -50,9 +50,9 @@ pub fn main() void {
|
||||||
// In order to output a text that can be evaluated by the
|
// In order to output a text that can be evaluated by the
|
||||||
// Zig Builder, we need to write it to the Error output.
|
// Zig Builder, we need to write it to the Error output.
|
||||||
// In Zig we do this with "std.debug.print" and in C we can
|
// In Zig we do this with "std.debug.print" and in C we can
|
||||||
// specify the file descriptor i.e. 2 for error console.
|
// specify a file descriptor i.e. 2 for error console.
|
||||||
//
|
//
|
||||||
// In this case we use 'write' to output 17 chars,
|
// In this exercise we use 'write' to output 17 chars,
|
||||||
// but something is missing...
|
// but something is missing...
|
||||||
const c_res = write(2, "Hello C from Zig!", 17);
|
const c_res = write(2, "Hello C from Zig!", 17);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue