Explain this code.
#include <stdio.h>
void f1(int *k)
{
*k = *k + 10;
}
main ( ){
int i;
i = 0;
printf (" The value of i before call %d \n", i);
f1 (&i);
printf (" The value of i after call %d \n", i);
}
Answer Posted / ankita sharma
answer will be 10. as k has the address of i so when we write *k=*k+10; *k meand that value to which k is pointing so it is pointing to i and i has the value 0 as intial value so 10 would be added to the value of i. so output will be 10.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
I have seen function declarations that look like this
What is the use of bit field?
What are the 3 types of structures?
Where define directive used?
What is difference between Structure and Unions?
How arrays can be passed to a user defined function
How can I recover the file name given an open stream?
How do you view the path?
What is c system32 taskhostw exe?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
What are control structures? What are the different types?
What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
What are pointers? Why are they used?