You are here:

C/linkfloat()

Advertisement


Question

hello narendra

I regularly read the questions asked by anyone The same ques which ravi has asked about the need of linkfloat(). also i m unable to understand the need of this function.

main()
{
   struct book
     {
        char name;
        float price;
        int pages;
     };
   struct book b[3];  
   int i;
for(i=0;i<=2;i++)
 {
    printf("enter name price and pages");
    scanf("%c %f %d",&b[i].name,&bi].price,
              &b[i].pages);
 }
for(i=0;i<=2;i++)
    printf("%c%f%d",b[i].name,b[i].price,
         b[i].pages);
}
void linkfloat()
{
 float a=0,*b;
 b=&a;
 a=*b;
}

please make it clear why this function linkfloat()is used ?and where its prototype is stored?

thank you
monika  

Answer
In this program, linkfloat() is not used anywhere.
I don't know where he intends to use it.
And that function, doesn't do much.
It is not getting any parameters from outside, nor it is sending any return value and also it is not making use of any global variables.
So, I don't see any use for this function.

He is declaring a pointer b and giving the address of a to it.
So, if he changes *b or a, both will have the same effect.

> and where its prototype is stored?
Which prototype?
Prototype of linkfloat()?
It should be declared before main() function.

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.