TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Rowan Crowe
from: andrew clarke
date: 1996-08-23 13:33:12
subject: Passing a var.

20 Aug 96 04:27, Rowan Crowe wrote to Frank Adam:

 FA>> Does passing a pointer to a function effect performance, as opposed 
 FA>> to having the contents of said pointer global or local ?

 > Don't quite understand this one. Do you mean storing the return value 
 > in a global variable?

(I think) he means the difference between

  void myFunc(int *ptr)
  {
      /* do something with ptr */
  }

  int main(void)
  {
      int i;
      myFunc(&i);
      return 0;
  }

and

  int i;

  void myFunc(void)
  {
      /* do something with i */
  }

  int main(void)
  {
      myFunc();
      return 0;
  }

and

  void myFunc(void)
  {
      int i;
      /* do something with i */
  }

  int main(void)
  {
      myFunc();
      return 0;
  }

Regards
Andrew

-- randy{at}zws.com

--- Msged/2 4.00
* Origin: Blizzard of Ozz, Melbourne, Australia (3:635/727.4{at}fidonet)
SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 728 711/401 409 410
SEEN-BY: 711/413 430 808 809 932 934 712/515 713/888 714/906 800/1
@PATH: 635/727 544 50/99 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.