Computer programming - Homework 10

1. Length-prefixed strings An alternative to null-terminated strings, used in other languages such as Pascal, is storing the length in the first byte of the string, followed by the string itself. A terminator is not needed, but the string length is limited to 255 (alternatively, more bytes could be used for the length).
Write a function that takes two length-prefixed strings and returns their concatenation, dynamically allocated in the same format.

2. Matrix addition Write a function that takes two matrices of reals (and their common dimensions) and returns their sum, dynamically allocated. Check that the result can itself be used as a parameter to the addition function.


Marius Minea
Last modified: Tue Dec 1 9:30:00 EET 2015