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



Explain this code. #include <stdio.h> void f1(int *k) { *k = *k + 10; } main (..

Answer / pooja agarwal

10

Is This Answer Correct ?    11 Yes 0 No

Explain this code. #include <stdio.h> void f1(int *k) { *k = *k + 10; } main (..

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

Explain this code. #include <stdio.h> void f1(int *k) { *k = *k + 10; } main (..

Answer / vivek

it will produce an error as constant cant be added to a pointer

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More C Interview Questions

c program to subtract between two numbers without using '-' sign and subtract function.

1 Answers  


What is this infamous null pointer, anyway?

0 Answers  


What is the benefit of using an enum rather than a #define constant?

0 Answers  


Write the program for displaying the ten most frequent words in a file such that your program should be efficient in all complexity measures.

3 Answers   Google,


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)

6 Answers   amu, TCS,






Give a fast way to multiply a number by 7

15 Answers   Accenture, Aricent, Microsoft,


What is difference between array and structure in c?

0 Answers  


Is it possible to initialize a variable at the time it was declared?

0 Answers  


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 ?

0 Answers  


write a c program to find biggest of 3 number without relational operator?

12 Answers   TCS, Wipro,


why you will give me a job in TCS.

7 Answers   TCS,


write a program of bubble sort using pointer?

3 Answers   TCS,


Categories