facebook like button

07 May, 2011

User Defined Functions (UDF) in C

Till now you people have seen many programs in this blog. There are many functions used in those programs like printf(), scanf(), putchar() etc... All these functions perform some job in the program. All these functions are provided to you by C language (we call them built-in C functions). By combination of these functions we make our program to do something useful for us. There may be situations when you have very big program where you need to use a same sequence of code (written by combining built-in functions) many times in that program (Lets say its a 10 line sequence of code and you have to write it 5 different places in the program.) In that situation perhaps you can think, "How nice it would be if there existed a direct function to replace this sequence???"
Your this thinking is correct. Here in C we have something called USER DEFINED FUNCTIONS (UDF). These are the functions those are not built-n in C but are the combination of other built-in or user defined functions. For people who are hearing the term UDF first time I would like to say that
just for now think UDF as a replacement of that sequence of code described above. Though these are more than that. You people will come to know more as you go through next posts and practice more.
    It took me a lot of time to decided whether to put UDF first or structures. Finally I decided to put UDFs first. This will be only the introduction. After that we'll go to structures and pointers and again go into details of UDFs. For those who are hearing these terms first time I would like to say: "Don't worry. Everything will be explained in the easiest way possible."  Now I'll be putting some programs on UDF (some are same programs which I have posted before). You are advised to see and compare codes of both the programs.

No comments:

Post a Comment

feel free to ask your doubts... if any
you can post your doubts on
www.facebook.com/programsimply