#include <stdio.h>
#include <pthread.h>

void* stampa_numeri_e_carattere(void* arg) {
    void** args = (void**) arg; // Cast dell'argomento a un array di void*
    int max = *(int*) args[0];  // Primo parametro: numero massimo
    char simbolo = *(char*) args[1]; // Secondo parametro: carattere

    for (int i = 1; i <= max; i++) {
        printf("%d %c\n", i, simbolo);
    }
    return NULL;
}

int main() {
    pthread_t thread;

    int max = 5;        // Numero massimo da stampare
    char simbolo = '*'; // Carattere da stampare

    // Creazione dell'array di parametri
    void* args[2];
    args[0] = &max;
    args[1] = &simbolo;

    // Creazione del thread con passaggio di parametri
    pthread_create(&thread, NULL, stampa_numeri_e_carattere, (void*) args);

    // Attesa della terminazione del thread
    pthread_join(thread, NULL);

    printf("Programma terminato.\n");
    return 0;
}