Tuesday, July 14, 2009

Difference between library functions and user defined functions in c language?

Does the phrase "user defined" mean anything to you?


.

Difference between library functions and user defined functions in c language?
A user defined function is something you the programmer has defined to perform a specific action or calculation in your program.





Example, you need to calculate somebody's age to the nearest minute. You create a calculateAge function:





double calculateAge(Date dateOfBirth)


{


}





So it is specific to your needs at this time.





A library function has been written by someone else, and is reusuable by many programmers to solve the same problem over and over.





Example: strcpy in C. If you are using C, you will never need to write functions for string manipulation because somebody else did that a long time ago...

tarot cards

2 comments:

  1. 1.LF(library functions) are Predefined functions.
    2.UDF(user defined functions) are the function which r created by user as per his own requirements.
    3.UDF are part of the program which compile runtime
    4.LF are part of header file
    (such as MATH.h) which is called runtime.
    5.In UDF the name of function id decided by user
    6.in LF it is given by developers.
    7.in UDF name of function can be changed any time
    8.LF Name of function can't be
    changed.
    9.Example(LF) : SIN, COS, Power
    Example(UDF): fibo, mergeme

    ReplyDelete
  2. 1.LF(library functions) are Predefined functions.
    2.UDF(user defined functions) are the function which r created by user as per his own requirements.
    3.UDF are part of the program which compile runtime
    4.LF are part of header file
    (such as MATH.h) which is called runtime.
    5.In UDF the name of function id decided by user
    6.in LF it is given by developers.
    7.in UDF name of function can be changed any time
    8.LF Name of function can't be
    changed.
    9.Example(LF) : SIN, COS, Power
    Example(UDF): fibo, mergeme

    ReplyDelete