void function and pointers

Russel Winder russel at UCL-CS.ARPA
Tue Feb 12 01:47:37 AEST 1985


Dear all,

Please could someone enlighten me about the following piece
of C code.  It looks perfectly legal to me and if I replace
all instances of void with int then it works as expected.

	static void test() { printf("Hello there\n"); }
	static void (*fptr) () = test;
	main() { (*fptr)(); }

The third line gives the error:

	, line 5: operands of = have incompatible types


Russel Winder			(russel at ucl-cs)
Department of Computer Science
University College London
Gower Street
London		WC1E 6BT
England



More information about the Comp.unix.wizards mailing list