C++ : function as a parameter

  • maths_fan
  • Newbie
  • Newbie
  • maths_fan
  • Posts: 5

Post 3+ Months Ago

Is it possible to write:

void g(void f(int i));

I know that better to write

void g(void (*f)(int i));

but the compiler doesn't mind the first one as well

???
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • phpSelectah
  • Student
  • Student
  • User avatar
  • Posts: 97

Post 3+ Months Ago

I am sure your compiler will let you get away with both of those,
but I cannot gaurantee they will both produce the desired results.

=-o
  • maths_fan
  • Newbie
  • Newbie
  • maths_fan
  • Posts: 5

Post 3+ Months Ago

They produce, in fact. I think there is no difference...

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: Liamw411 and 46 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.