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
What is double pointer?
How can I recover the file name given an open stream?
Give differences between - new and malloc() , delete and free() ?
What are local static variables? How can you use them?
What is wrong in this statement?
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion
What are linked lists in c?
What is the size of enum in bytes?
What are the types of operators in c?
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
What are register variables in c?
Explain what are bus errors, memory faults, and core dumps?
What does sizeof function do?
How can you read a directory in a C program?
What is the value of c?