CCCPaste

Ex6.1 C Lab

int slengthptr(char s[]) {
    int count = 0;
    char *sptr = s; // puntatore char perchè s è un char

    if (sptr == NULL) {
        return -1;
    }

    while (*sptr!='\0') {
        count++;
        sptr++;
    }

    return count;
}