Изменение параметров

Функции

//a parameter is a local copy: the function may change it,
//the variable of the caller stays the same
void print_max5(const char *data) {
    char head[6];
    if (strlen(data) > 5) {
        snprintf(head, sizeof head, "%s", data);
        data = head;
    }
    printf("%s\n", data);
}

const char *data = "1234567";
print_max5(data);
//printed "12345"
//data is "1234567"

printf("data is %s\n", data);