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
What is a file descriptor in c?
A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
Which control loop is recommended if you have to execute set of statements for fixed number of times?
Without Computer networks, Computers will be half the use. Comment.
What are the benefits of c language?
Why are algorithms important in c program?
Why c is faster than c++?
Is c programming hard?
What is scope and lifetime of a variable in c?
Write a program to print ASCII code for a given digit.
How can I call a function with an argument list built up at run time?
is it possible to create your own header files?
how do you programme Carrier Sense Multiple Access
What is the difference between malloc() and calloc()?