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 |
What is wild pointer in c with example?
Why is struct padding needed?
Identify the correct argument for the function call fflush () in ANSI C: A)stdout B)stdin C)stderr D)All the above
How can I direct output to the printer?
write a program to rearrange the array such way that all even elements should come first and next come odd
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
how to print this pyramid * * * * * * * * * * * * *
Write a program to find given number is even or odd without using any control statement.
How are pointers declared in c?
How do I determine whether a character is numeric, alphabetic, and so on?
write a program to fined second smallest and largest element in a given series of elements (without sorting)
WHO WROTE C LANGUAGE?