question in alias parameter`

This is a discussion on question in alias parameter` within the C++ Programming forums, part of the General Programming Boards category; hello guys, i am new to c++ programming, when i was going through the pointer with reference that is alias ...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    181

    question in alias parameter`

    hello guys,

    i am new to c++ programming, when i was going through the pointer with reference that is alias can i send a array as a reference paramter to the calling function. the code example is as follow

    Code:
    void  incr(double &);  function prototype
    
    itn main()
    {
                double ar[10];
    
                incr(ar);
    
    }
    
    void incr(double &arr)
    { 
        .
        .
        .
    }
    is the code is valid, is not hhow to do it

    thanks in advance

  2. #2
    Registered User xxxrugby's Avatar
    Join Date
    Jan 2005
    Posts
    178
    Example .. Equivalent pointer types
    Code:
    int first(int const array[10]); // Size is ignored
    
    int first(int const array[]);   // Equivalent declaration
    
    int first(int const *array);    // Equivalent declaration
    
    int first(int const *array)     // Definition
    
    {
    
      return array[0];
    
    }
    
    
    
    int apply(int func(int), int arg);
    
    int apply(int func(int const), int);         // Equivalent
    
    int apply(int (*func)(int), int arg);        // Equivalent
    
    int apply(int (*func)(int const), int arg)   // Definition
    
    {
    
      return func(arg);
    
    }
    Sorry for spelling errors, not English!
    xxxrugby: "All Human Race Will Die From My Hand!"
    xxxrugby: "We are all philosophers, when question is about politics!"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21