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,154 of 33,346   
   Neb to Neb   
   Re: Passing by Reference   
   16 Apr 12 23:52:49   
   
   From: null@nowhere.com   
      
   { Please restrict your quoting to the minimum needed to   
   establish context -mod/we }   
      
   On 16/04/2012 10:04 PM, Neb wrote:   
   > Hi all,   
   >   
   > Im new to c/c++ programming and am having difficulty in passing more   
   > than one parameter into and out of a function.   
   >   
   > //PASS BY REFERENCE   
   > #include    
   > void swapnum(int &i,int &j)   
   > {   
   > int temp = i;   
   > i = j;   
   > j = temp;   
   > return;   
   > }   
   >   
   > int main()   
   > {   
   > int a = 10;   
   > int b = 20;   
   >   
   > swapnum(a, b);   
   > printf("A is %d and B is %d\n", a, b);   
   > return (0);   
   > }   
   >   
   > In compiling I am recieving the error:   
   >   
   > Error E2293 test.ccp 4: ) expected   
   >   
   >   
   > Thanks in advance, any help is greatly appreciated.   
   >   
   >   
      
      
   Thanks for the advice fellas.   
      
   The issue was with the filetype, should have been .cpp vs .ccp.   
      
      
   --   
         [ 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