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


Please Help Members By Posting Answers For Below Questions

Can true be a variable name in c?

555


Do you know the difference between exit() and _exit() function in c?

607


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

1511


What is c programing language?

612


Tell us the use of fflush() function in c language?

635






write an algorithm to display a square matrix.

2218


If errno contains a nonzero number, is there an error?

798


What is mean by data types in c?

549


Is there a way to jump out of a function or functions?

631


which type of aspect you want from the student.

1701


what is stack , heap ,code segment,and data segment

2214


What is p in text message?

536


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1255


How can I write functions that take a variable number of arguments?

624


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

1631