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 d scanf?
Hi, main() { } Is a user defined function or Built in Functionn
Difference between strcpy() and memcpy() function?
Please list all the unary and binary operators in C.
how to swap 2 numbers within a single statement?
What is difference between main and void main?
Do you know pointer in c?
Give the Output : * * * * * * * * * *
why programming language C is still used in operating system's kernel??
Why is c so important?
#define MAX 3 main() { printf("MAX = %d \n",MAX ); #undef MAX #ifdef MAX printf("Vector Instituteā); #endif
write a c program to add two integer numbers without using arithmetic operator +