The operator ++ and C calling

Postby Cuchulainn » Mon Sep 27, 2010 9:49 pm

What's happening here?



// Quiz.cpp

//

// Run with VS 2010

//

// DJD



#include <iostream>

#include <string>

using namespace std;



void fu1(int a, int b, string s)

{ // call by value



cout << s << "--> ";

cout << "First arg: " << a << ", ";

cout << "Second arg: " << b << endl;

}





int main()

{



int i = 10;



fu1(i,i, "0");



i = 10; fu1(i++,i++, "1"); // 11,10

i = 10; fu1(++i,++i, "2"); // 12,12

i = 10; fu1(i++,i,"3"); // 10,11

i = 10; fu1(i,i++, "4"); // 11,10

i = 10; fu1(++i,i, "5"); // 11,11

i = 10; fu1(i,++i, "6"); // 11,11





return 0;



}
User avatar
Cuchulainn
 
Posts: 668
Joined: Mon Dec 18, 2006 2:48 pm
Location: Amsterdam, the Netherlands

Return to C++ Certification and Examinations: Advanced Level

Who is online

Users browsing this forum: No registered users and 2 guests

cron