Output based Question

What is the output of following program?

# include 

void func(int a){

    a = 30;

}

 int main(){

  int b = 20;  

func(b);  

printf("%d", b); 

 return 0;

}

Option 1: 20Option 2: 30Option 3: compile error Option 4: runtime error

CodingNinjas
author
2y

This was an output-based question asked in the C Programming section.
This was an easy question but tricky as well. If you are not clear with C basics.
In this question value of b is pass by value to "f...read more

qwerty100
3mo
works at
Ans: option1 Bcz b variable is passed as value
Help your peers!
Add answer anonymously...
Qualcomm Associate Technology Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter