IronGOLEM/wiki/strncpy.md

17 lines
461 B
Markdown
Raw Normal View History

2023-07-26 06:34:17 -04:00
# STRNCPY
Strncpy is a function that takes two chars lists and a number as a parameter and write the second in the first but only the n - 1 first char (like strncpy in C)
## params
1. chars list
2. chars list
3. number
## example
```
strncpy("y", "o", 2) "y" => "o"
strncpy("y", "", 1) "y" => ""
strncpy("", "o", 2) "" => "o"
strncpy("hello ", "world!", 7) => "world!"
strncpy("hello ", "world!", 14) => "world!"
strncpy("hello ", "world!", 0) => "hello "
```