Język C. W jaki sposób prawidłowo zdefiniować i wywołać wskaźnik do funkcji? Po wpisaniu tekstu w podświetlonej linii 26 mam crash programu.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *wczytaj(char *wyraz, int ile) {
char *wynik, *tutaj;
wynik = fgets(wyraz, ile, stdin);
if (wynik) {
tutaj = strchr(wyraz, '\n');
if (tutaj)
*tutaj = '\0';
else
while (getchar() != '\n')
continue;
}
return wynik;
}
int main(void)
{
char(*wsk_do_funkcji)(char *, int);
wsk_do_funkcji = *wczytaj;
printf("adres %p\n", wsk_do_funkcji);
char word[20];
printf("%s \n", wsk_do_funkcji(word, 20));
printf("%s \n", (*wsk_do_funkcji)(word, 20));
return EXIT_SUCCESS;
}