home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,150 of 33,346   
   Ulrich Eckhardt to All   
   Re: Passing by Reference   
   16 Apr 12 15:07:21   
   
   From: ulrich.eckhardt@dominolaser.com   
      
   Am 16.04.2012 16:04, schrieb Neb:   
   > Im new to c/c++ programming and am having difficulty in passing more   
   > than one parameter into and out of a function.   
      
   Note up front: Since this is a moderated group, you have a rather high   
   latency until your posting shows up. For complex questions, this doesn't   
   matter, but for short questions I'd either suggest the dedicated   
   beginners' group (comp.lang.learn.c-c++) or one of the C++ channels on   
   IRC, where you might get help in real time.   
      
      
   > #include    
      
   If any book starts with teaching printf(), it is probably a bad book for   
   learning C++, provided you want to learn C++ and not C. Note that it   
   isn't clear which of those two _distinct_ languages you want to learn.   
      
      
   > void swapnum(int &i,int &j)   
   > {   
   >     int temp = i;   
   >     i = j;   
   >     j = temp;   
   >     return;   
   > }   
      
   Note that in  (or was it ?) is a function called   
   std::swap() which does exactly the above.   
      
      
   > Error E2293 test.ccp 4: ) expected   
      
   I haven't tried it but the code is C++ and seems actually okay. However,   
   I think you are compiling it with a C compiler, is that possible? The C   
   compiler then chokes on the references, which only C++ supports. Also   
   note that typically, C++ source files are called "cpp" and not "ccp".   
      
   Good luck!   
      
   Uli   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca