Values & References6 / 18
Up next

Pointer to const

#include <stdio.h>

size_t count_bytes(const char *p) {
    size_t n = 0;
    while (*p++ != '\0') {
        n++;
    }
    return n;
}

int main(void) {
    printf("%zu\n", count_bytes("hello"));
    return 0;
}
What you're solving

promise not to modify the pointee