In the below code, how do you modify the value 'a' and print
in the function. You'll be allowed to add code only inside
the called function.

main()
{
int a=5;
function(); // no parameters should be passed
}
function()
{
/* add code here to modify the value of and print here */
}



In the below code, how do you modify the value 'a' and print in the function. You'l..

Answer / aravind

#include<stdio.h>
void function(void );
int main()
{
int a=5;
function();
}
function()
{
int a=4;
printf("%d",a); /* a here is a local variable*/
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

0 Answers   InterGraph,


Why clrscr is used after variable declaration?

0 Answers  


List some of the static data structures in C?

0 Answers  


What is structure of c program?

0 Answers  


Is javascript based on c?

0 Answers  






#include<stdio.h> int fun(); int i; int main() { while(i) { fun(); main(); } printf("hello \n"); return 0; } int fun() { printf("hi"); } answer is hello.how??wat is tat while(i) mean?

7 Answers   Intel,


write a program without using main function?

2 Answers   TCS,


how to add numbers without using arithmetic operators.

14 Answers   TCS,


Write a program to compare two strings without using the strcmp() function

42 Answers   Accenture, Arba Minch University,


What is the most efficient way to count the number of bits which are set in an integer?

0 Answers  


What is advantage of pointer in c?

0 Answers  


what is the answer for it main() { int i; clrscr(); printf("%d",&i)+1; scanf("%d",i)-1; }

3 Answers  


Categories