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);
}
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / vivek
it will produce an error as constant cant be added to a pointer
| Is This Answer Correct ? | 1 Yes | 4 No |
compute the nth mumber in the fibonacci sequence?
10 Answers Canon, HPL, Satyam, TCS,
Is this program statement valid? INT = 10.50;
Why is a semicolon (;) put at the end of every program statement?
what is the difference between <stdio.h> and "stdio.h"
14 Answers Invendis, Kanbay, Mastek, MathWorks,
Why c is faster than c++?
What is the difference between c and python?
What is the explanation for cyclic nature of data types in c?
what does data structure mean?
Explain what’s a signal? Explain what do I use signals for?
What are structural members?
Explain how can I manipulate strings of multibyte characters?
How do you determine a file’s attributes?