ok. I was thinking c++, you can pass reference which is diff from a pointer.


Thanks,
Tyler Littlefield
Web: tysdomain.com
email: [email protected]
My programs don't have bugs, they're called randomly added features.

  ----- Original Message ----- 
  From: Michael Comperchio 
  To: [email protected] 
  Sent: Thursday, April 02, 2009 11:11 AM
  Subject: Re: [c-prog] returning arrays


  a hunting dog!

  A pointer is something that is pointing to a place in memory.... hence 
  pointer. When I learned 'C' (dinosaurs still on earth) I was taught 
  there are two ways to pass something to a function. By Value, and By 
  Reference. When I pass by value, a copy of the original data is pushed 
  on the stack, and the calling function pops it off. Because it's a copy 
  only, I can manipulate it to my hearts content, and not change the 
  original. When I pass 'by reference' I push the memory location which 
  references (points to, hence pointer) the original data. When my 
  function pops the reference off the top of the stack I can manipulate 
  what is pointed to by the memory address,

  I miss coding in c for a living. there is sooooo much fun to be had 
  with it!

  Michael

  Commander: "I assure you the project will be completed on time!"
  Darth: "The emperor does not share your optimistic appraisal of the 
  situation"

  On Apr 2, 2009, at 10:51 AM, Allison Vollmann wrote:

  > and what is an pointer?
  >
  > Em 2/4/2009 11:41, Tyler Littlefield escreveu:
  > >
  > > as reference? that's as pointer.
  > >
  > > Thanks,
  > > Tyler Littlefield
  > > Web: tysdomain.com
  > > email: [email protected] <mailto:tyler%40tysdomain.com>
  > > My programs don't have bugs, they're called randomly added features.
  > >
  > > ----- Original Message -----
  > > From: Allison Vollmann
  > > To: [email protected] <mailto:c-prog%40yahoogroups.com>
  > > Sent: Thursday, April 02, 2009 8:09 AM
  > > Subject: Re: [c-prog] returning arrays
  > >
  > > pass the array as reference in the function.
  > >
  > > void chArray(int *array)
  > > {
  > > array[0] = 4;
  > > }
  > >
  > > int main(void)
  > > {
  > > int arr[] = {1,2,3};
  > > ...
  > > chArray(&arr[0]);
  > > ...
  > > return 0;
  > > }
  > >
  > > Em 2/4/2009 10:41, rsashwinkumar escreveu:
  > > >
  > > > this may be very basic but plz., help
  > > >
  > > > How to pass an array(1 Dimensional) to a function, multiply its
  > > > elements by 2 and return to main function and assign to another 
  > array...
  > > >
  > > > Plz., help urgent...
  > > >
  > > >
  > >
  > > [Non-text portions of this message have been removed]
  > >
  > >
  >
  > 



  

[Non-text portions of this message have been removed]

Reply via email to