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 */
}
Answer Posted / 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 View All Answers
In which layer of the network datastructure format change is done
`write a program to display the recomended action depends on a color of trafic light using nested if statments
Explain the advantages of using macro in c language?
What does %c do in c?
What is string constants?
What is the difference between Printf(..) and sprint(...) ?
Explain About fork()?
Why can arithmetic operations not be performed on void pointers?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
Which control loop is recommended if you have to execute set of statements for fixed number of times?
What is assert and when would I use it?
What are predefined functions in c?
What are global variables?
Explain how can you be sure that a program follows the ansi c standard?
What is function and its example?