Skip to content

Commit

Permalink
Move the splat operator explanation.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Dec 7, 2024
1 parent e811f4c commit 7043fde
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/content/docs/FAQ/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ fn int[] buggy_code()
}
```

**Q:** How do I pass varargs to another function that takes varargs?

**A:** Use the splat operator, `...`

```c3
fn void test(String format, args...)
{
io::printfn(format, ...args);
}
fn void! main()
{
test("Format: %s %d", "Foo", 123);
}
```

**Q:** What are vectors?

**A:** Vectors are similar to arrays, but declared with `[< >]` rather than `[ ]`, the element type may also only
Expand Down Expand Up @@ -203,22 +219,6 @@ Allocator* temp = allocator::temp();
};
```

**Q:** How do I pass varargs to another function that takes varargs?

**A:** Use the splat operator, `...`

```c3
fn void test(String format, args...)
{
io::printfn(format, ...args);
}
fn void! main()
{
test("Format: %s %d", "Foo", 123);
}
```

## Interfacing with C code

**Q:** How do I call a C function from C3?
Expand Down

0 comments on commit 7043fde

Please sign in to comment.