From aeb3673d7c30479778419e4f17052d312f0ed40c Mon Sep 17 00:00:00 2001 From: OGordoo Date: Mon, 21 Jun 2021 14:44:54 +0100 Subject: [PATCH 1/2] printmemory Change exercise --- subjects/printmemory/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subjects/printmemory/README.md b/subjects/printmemory/README.md index a0e5799a..3ea0d5b6 100644 --- a/subjects/printmemory/README.md +++ b/subjects/printmemory/README.md @@ -4,9 +4,9 @@ Write a function that takes `(arr [10]int)`, and displays the memory as in the example. -After displaying the memory the function must display all the graphic characters. The non printable characters must be replaced by a dot. +After displaying the memory the function must display all the ASCII graphic characters. The non printable characters must be replaced by a dot. -A graphic character is any character intended to be written, printed, or otherwise displayed in a form that can be read by humans. In other words, it is any encoded character that is associated with one or more glyphs. +The ASCII graphic characters are any characters intended to be written, printed, or otherwise displayed in a form that can be read by humans, present on the ASCII encoding. ### Expected function @@ -32,9 +32,9 @@ And its output : ```console $ go run . | cat -e -6800 0000 6500 0000 6c00 0000 6c00 0000 $ -6f00 0000 1000 0000 1500 0000 2a00 0000 $ -0000 0000 0000 0000 $ +68 65 6c 6c$ +6f 10 15 2a$ +00 00$ hello..*..$ $ ``` From eca9ebba95f9d70b940f2b9d5100524deef35fd9 Mon Sep 17 00:00:00 2001 From: OGordoo Date: Wed, 30 Jun 2021 16:36:56 +0100 Subject: [PATCH 2/2] byte array --- subjects/printmemory/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subjects/printmemory/README.md b/subjects/printmemory/README.md index 3ea0d5b6..8926a49b 100644 --- a/subjects/printmemory/README.md +++ b/subjects/printmemory/README.md @@ -2,7 +2,7 @@ ### Instructions -Write a function that takes `(arr [10]int)`, and displays the memory as in the example. +Write a function that takes `(arr [10]byte)`, and displays the memory as in the example. After displaying the memory the function must display all the ASCII graphic characters. The non printable characters must be replaced by a dot. @@ -11,7 +11,7 @@ The ASCII graphic characters are any characters intended to be written, printed, ### Expected function ```go -func PrintMemory(arr [10]int) { +func PrintMemory(arr [10]byte) { } ``` @@ -24,7 +24,7 @@ Here is a possible program to test your function : package main func main() { - PrintMemory([10]int{104, 101, 108, 108, 111, 16, 21, 42}) + PrintMemory([10]byte{'h', 'e', 'l', 'l', 'o', 16, 21, '*'}) } ```