quindi dovrebbe venire così?
codice:
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
struct nodo *crealista();
void stampalista(struct nodo *p);
void sottolistedispari (struct nodo *, int);
struct nodo{
int dato;
struct nodo *next;
};
main()
{
int somma;
struct nodo *start, *p, *q;
start = crealista();
stampalista (start);
printf("\n\n\n");
sottolistedispari(start, lenght (start));
system("PAUSE");
return 0;
}
struct nodo *crealista()
{
struct nodo *p, *start, *last;
int i, n, x;
start = NULL;
srand(time(NULL));
printf ("Quanti nodi ha la lista? \n");
scanf("%d", &n);
if(n<=0){
printf("Inserisci un numero di nodi maggiore di zero: \n");
scanf("%d", &n);
}
for(i=0; i<n; i++){
p = (struct nodo *)malloc(sizeof (struct nodo));
if(i == 0)
start = p;
else
last->next = p;
p->dato = rand() % (1) + 25;
p->next = NULL;
last = p;
}
printf("\n\n\n");
return(start);
}
void stampalista(struct nodo *p)
{
while(p != NULL){
printf("%d -->", p->dato);
p = p->next;
}
printf("NULL \n\n\n");
}
void sottolistedispari (struct nodo *lista, int n)
{
struct nodo *temp, *temp1 ;
int j, k, i, somma;
do {
printf("Inserisci un valore di k minore di n: ");
scanf("%d", &k);
} while(k>=n);
temp = lista;
for(i=0; i<(n-k); i++){
for(j=i; j<(i+k); j++){
somma = somma + temp->dato;
temp = temp->next;
}
if(somma % 2 != 0){
temp1 = temp->next;
temp->next = NULL;
stampalista(temp);
temp->next = temp1;
}
lista = lista->next;
temp = lista;
}
}
ma il compilatore continua a darmi lo stesso errore "too few arguments to function 'voi sottolistedispari(nodo*, int)"