Thank you very much for the answers. As I suspected I was missing something: I wasn't using the format specifier %zu, because I didn't know it existed, so my results were different. Although I got the correct results for "a", it's good to know I should have also used %zd for ssize_t