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 |
c program to subtract between two numbers without using '-' sign and subtract function.
What is this infamous null pointer, anyway?
What is the benefit of using an enum rather than a #define constant?
Write the program for displaying the ten most frequent words in a file such that your program should be efficient in all complexity measures.
given the piece of code int a[50]; int *pa; pa=a; to access the 6th element of the array which of the following is incorrect? a.*(a+5) b.a[5] c.pa[5] d.*(*pa + 5)
Give a fast way to multiply a number by 7
15 Answers Accenture, Aricent, Microsoft,
What is difference between array and structure in c?
Is it possible to initialize a variable at the time it was declared?
we need to calculating INCOME TAX for the person. The INCOME TAX is as follows:- First $10000/- of income : 4% tax Next $10000/- of income : 8% tax Next $10000/- of income : 11.5% tax above $10, 00,00/- : 15% tax What is the Solution of this Question ?
write a c program to find biggest of 3 number without relational operator?
why you will give me a job in TCS.
write a program of bubble sort using pointer?