Oto mam taki kodzik(to nie jest cały program ofc):
int wprowadz(int rozmiar, int *t, int a, int b) {
int i,tmp;
if (a < b) {
tmp = a;
a = b;
b = tmp;
}
for(i=0; i<rozmiar; i++) {
*t = a + rand()%(b - a);
t++;
}
return 0;
}
int main(int argc, char *argv[] ){
int i;
int *tab, *tab_pom;
int (*wsk)(int,*int,int,int); //:38
wsk = &wprowadz; //:39
if (argc != 4) {
printf("Blad wywolania programu...",argv[0]);
}
if((tab = calloc(atoi(argv[1]),sizeof(int))) == NULL) {
printf("Blad alokacji pamieci ...\n"); exit(1);
}
(*wsk)(atoi(argv[1]),tab, atoi(argv[2]), atoi(argv[3]));
wyswietl(atoi(argv[1]),tab);
free(tab);
}
W programie muszę wykorzystać wskaźniki do funkcji. Ale coś mi się pierdzieli przy kompilacji. Nie wiem czy dobrze deklaruję zmienną wskaźnikową.
Błędy:
:38 expected declaration specifiers or '...' before '*' token
:39 'wsk' undeclared (first use in this function)
Mógłby mi ktoś pomóc?