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
how should functions be apportioned among source files?
What do you know about the use of bit field?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
Explain two-dimensional array.
Is printf a keyword?
A variable that is defined in a specified portion of a program but can be used throughout the program a) global variable b) local variable c) character d) none
What is the sizeof () operator?
I need a sort of an approximate strcmp routine?
What is the difference between local variable and global variable in c?
What are the types of arrays in c?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
What are the complete rules for header file searching?
swap 2 numbers without using third variable?
Explain what does it mean when a pointer is used in an if statement?
What is a macro, and explain how do you use it?