edited by
523 views
0 votes
0 votes
void main()
{
    int  x=10, y=5;
    swap(x,y);
    print(x,y);
}

void swap(int a, int b)
{
    int c, x=0;
    c=a;
    a=b;
    b=c;
}



what is output using call by text?

a) 5  0

b) 5   10

c) 10   0

d) 10   10

edited by

1 Answer

0 votes
0 votes
according to the concept of inline functions. That is how we represent the concept of call by text or call by name in c ++

The answer should be:

Option A: 5  0

but as per the concept of macros in c i am still not clear on the correct answer for this.

here is a link for anyone who wants to go through the details of this:

http://www.cs.rit.edu/~rpj/courses/plc/lab4/lab47.html#Q12
edited by

Related questions

1 votes
1 votes
4 answers
1
Isha Karn asked Dec 9, 2014
983 views
int i = 1; int main() { int a[]= { 0,1, 2} ; f(a[i], i); printf("%d", a[i]); } void f(int x, int y) { y++; x=5*i; }In above function f() uses " call by name" technique, w...
2 votes
2 votes
2 answers
2
Isha Karn asked Dec 9, 2014
342 views
main() { int x, y= 100; float *P; P=&y; x=*P; printf("%d", x); }what is output?a) 100b) 1c) 0d) none
2 votes
2 votes
1 answer
3
Nishikant kumar asked Nov 16, 2015
1,027 views
P(X:integer,Y:integer) { X = 6; A = 8; return ( X + Y ) }if the function P were invoked by the following program fragment. k = 1; L = 1; Z = (K, L);Then the value of Z wo...
0 votes
0 votes
1 answer
4
shree asked Nov 22, 2014
523 views
What will be the second value printed by the program if parameter passing mechanism is call by reference?int b=10 //global begin procedure func(int x,int y) begin print(b...