algoritmi/esercizi/2021-11-04/registro/registro.c
/* This function makes a booking
 * Side effects: standard output can be modified. 
 * Pre-condition: k > 0, name != ' '.
 */
This function makes a booking
Side effects: standard output can be modified.
This function makes a booking Side effects : standard output can be modified .
void book(int k, int n, char *name, char **r) {
    if(k >= n || (r[k][0] != '\0')) {
        printf("Errore, posto inesistente o gia' occupato!\n");
    } else {
        r[k] = realloc(r[k], strlen(name));
        if(r == NULL) {
            printf("Errore durante l'allocazione!\n");
            exit(EXIT_FAILURE);
        }
        strcpy(r[k], name);
    }
}
void book ( int k , int n , char * name , char * * r ) { if ( k >= n || ( r [ k ] [ 0 ] != ' \0 ' ) ) { printf ( " \n " ) ; } else { r [ k ] = realloc ( r [ k ] , strlen ( name ) ) ; if ( r == NULL ) { printf ( " \n " ) ; exit ( EXIT_FAILURE ) ; } strcpy ( r [ k ] , name ) ; } }
This function makes a booking
 Side effects: standard output can be modified.
This function makes a booking Side effects : standard output can be modified .