Question:

What is function? and how many type ?

by  |  earlier

0 LIKES UnLike

What is function? and how many type ?

 Tags:

   Report

6 ANSWERS


  1. Private, Protected,Global, Friend functions


  2. Dont read computer science definition - when u have this doubt. I will make it very simple for you.

    You know about HOTDAIL in your mobile/land phone right. That is you press a number for say 2 seconds (ie. hot dail) to your most frequent call number (say home/spouse/friend/anyone to whom u frequently talk). The point is instead of dialing his/her/their phone number (say 8 to 10 digits) you just press 1 digit and THE SAME JOB IS DONE !! This is a function.

    Now this should give you an intuitive understanding on whats a function.

    So, in computer science terms its a frequent piece of code (any no. of lines of code) that you wish to call many (or even lots of times). Say u have 100 lines of code that you want to use 4 times at different places, instead of typing / even copy-pasting it, u create a function and call it 4 times.

    The best part of calling function 4 times instead of 400 lines of code is if u wish to change the function (imagine your home number in our hotdial example), you can simple change it in one place instead of 4...

    This should make u clear.. Now go ahead and u can understand the higher concepts that are built on top of this concept!

    All the best :-)

  3. i think u should download a c and c++ tutor frm internet tht can help u better.  gud luck

  4. A function is a piece of code with a specific purpose, usually it is comprised of a name, a parameter list with a type for each one, and a type for the function itself, a sample definition would be:

    Function Sum(A as Integer, B as Integer) as Integer

              Sum = A + B

    End Function

    .

    .

    .

    C = Sum(2,3)

    In this example, the function is called Sum, it receives two numeric parameters, which are added, and returned as an integer.

    After that, i show how the function should be used, whenever you want to add two numbers, you simply need to call the function, passing it the two numbers you'd want to add, and it should return the result, in this example, C would have a value of 5.

    Hope it helps

  5. function is block of code which can be reused

    this is the simplest defination i can give


  6. Function is a block of statement that is used to perform a task.

    There are two types of functions. They are:-

    1)In-built function

    2)User-defined function

    In-built funtions are those funtions which are already exists.

    Like printf(); getch(); etc..

    (In C)

    User-defined functions are those functions which a user creates according to the requirement.

    Like void sum();

    (In C)

Question Stats

Latest activity: earlier.
This question has 6 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.