f(x,y,z)
{
y = y+1;
z = z+x;
}
main()
{
int a,b;
a = 2
b = 2;
f(a+b,a,a);
print a;
}

what is the value of 'a' printed

Answers were Sorted based on User's Feedback



f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } ..

Answer / ravi

no change in value of a.
i.e,a = 2 only .

Is This Answer Correct ?    7 Yes 0 No

f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } ..

Answer / e-mail

a=2

Is This Answer Correct ?    4 Yes 0 No

f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } ..

Answer / fazlur

Yes the answer will b 2 because the variable a is local to
the main function only.so the value of a will not b changed.

Is This Answer Correct ?    3 Yes 0 No

f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } ..

Answer / sachin arora

Answer a=2
because f is a function and that time STACK concept are
used ,in a function last value a is printed and a=2;
so result will b 2

Is This Answer Correct ?    0 Yes 0 No

f(x,y,z) { y = y+1; z = z+x; } main() { int a,b; a = 2 b = 2; f(a+b,a,a); print a; } ..

Answer / rahul

6

Is This Answer Correct ?    0 Yes 6 No

Post New Answer

More C Interview Questions

which one is highest Priority in c? a)=,b)+,c)++,d)==

4 Answers  


#include<stdio.h> int main(){ int a[]={1,2,3,5,1}; int *ptr=a+4; int y=ptr-a; printf("%d",y); }

3 Answers   Zoho,


What does it mean when a pointer is used in an if statement?

0 Answers  


What is wrong in this statement?

0 Answers  


in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.

0 Answers   TCS,






What is the Difference between Class and Struct?

10 Answers   Motorola,


/*what is the output for the code*/ void main() { int r; r=printf("naveen"); r=printf(); printf("%d",r); getch(); }

1 Answers   CDAC,


What is static identifier?

0 Answers   TCS,


What are logical errors and how does it differ from syntax errors?

0 Answers  


Why can’t we compare structures?

0 Answers  


20. main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); } Answer:??????

2 Answers  


write c program to display output 10(10+20)+(10+20+30)+ ... n term

0 Answers   Hindustan Gum Chemicals,


Categories