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

a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

0 Answers  


a memory of 20 bytes is allocated to a string declared as char *s then the following two statements are executed: s="Etrance" l=strlen(s); what is the value of l ? a.20 b.8 c.9 d.21

4 Answers   TCS,


int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer

0 Answers  


What is mean by data types in c?

0 Answers  


How do you write a program which produces its own source code as its output?

4 Answers  






Is printf a keyword?

0 Answers  


which is conditional construct a) if statement b) switch statement c) while/for d) goto

0 Answers  


What was noalias and what ever happened to it?

0 Answers  


Tell me can the size of an array be declared at runtime?

0 Answers  


Do you know the purpose of 'register' keyword?

0 Answers  


How can I avoid the abort, retry, fail messages?

0 Answers  


Define VARIABLE?

0 Answers   ADP,


Categories