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
A banker has a seif with a cipher. Not to forget the cipher, he wants to write it coded as following: each digit to be replaced with the difference of 9 with the current digit. The banker chose a cipher. Decipher it knowing the cipher starts with a digit different than 9. I need to write a program that takes the cipher from the keyboard and prints the new cipher. I thought of the following: Take the input from the keyboard and put it into a string or an array. Go through the object with a for and for each digit other than the first, substract it from 9 and add it to another variable. Print the new variable. Theoretically I thought of it but I don't know much C. Could you give me any kind of hint, whether I am on the right track or not?
What are type modifiers in c?
Is it better to bitshift a value than to multiply by 2?
What are reserved words with a programming language?
What do header files do?
How can a process change an environment variable in its caller?
Are there any problems with performing mathematical operations on different variable types?
What is the -> in c?
Can you please explain the difference between exit() and _exit() function?
which is conditional construct a) if statement b) switch statement c) while/for d) goto
What is variable and explain rules to declare variable in c?
How do you search data in a data file using random access method?
What is an example of structure?
What is the modulus operator?
How can I manipulate strings of multibyte characters?