forked from root/public
![34804391+Frenchris@users.noreply.github.com](/git/assets/img/avatar_default.png)
![GitHub](/git/assets/img/avatar_default.png)
2 changed files with 24 additions and 20 deletions
@ -0,0 +1,24 @@ |
|||||||
|
## range |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
Write the function Range which must: |
||||||
|
|
||||||
|
- allocate (with make()) an array of integers. |
||||||
|
- fill it with consecutive values that begin at `start` and end at `end` (Including `start` and `end` !) |
||||||
|
- finally return that array. |
||||||
|
|
||||||
|
### Expected function |
||||||
|
|
||||||
|
```go |
||||||
|
func Range(start, end int) []int { |
||||||
|
|
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
Examples of outputs : |
||||||
|
|
||||||
|
- With (1, 3) you will return an array containing 1, 2 and 3. |
||||||
|
- With (-1, 2) you will return an array containing -1, 0, 1 and 2. |
||||||
|
- With (0, 0) you will return an array containing 0. |
||||||
|
- With (0, -3) you will return an array containing 0, -1, -2 and -3. |
@ -1,20 +0,0 @@ |
|||||||
## range |
|
||||||
|
|
||||||
### Instructions |
|
||||||
|
|
||||||
Write the following functions : |
|
||||||
|
|
||||||
```go |
|
||||||
func Range(start, end int) []int{ |
|
||||||
|
|
||||||
} |
|
||||||
``` |
|
||||||
|
|
||||||
It must allocate (with malloc()) an array of integers, fill it with consecutive values that begin at start and end at end (Including start and end !), then return a pointer to the first value of the array. |
|
||||||
|
|
||||||
Example of output : |
|
||||||
|
|
||||||
- With (1, 3) you will return an array containing 1, 2 and 3. |
|
||||||
- With (-1, 2) you will return an array containing -1, 0, 1 and 2. |
|
||||||
- With (0, 0) you will return an array containing 0. |
|
||||||
- With (0, -3) you will return an array containing 0, -1, -2 and -3. |
|
Loading…
Reference in new issue