Thread: Function definition clarification

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    347

    Function definition clarification

    Generally when developing an application or a logic we need to write a function. There is always chance that you can write either as void function with no arguments or something with function arguments and return values. Which one should i prefer? It is like i need to do lot analysis and come to some conclusion and then actually decide the function prototype. Am I correct? Please advise. Is there any industry standards?

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Which one should i prefer?
    There is no right answer to this question. Use the function that is right for the occasion. If the function needs information from the outside world, use a function that takes parameters, otherwise don't use parameters, otherwise use function parameters, or the return a value to pass the values to and from your functions.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GetLastError function clarification
    By Satya in forum C Programming
    Replies: 1
    Last Post: 05-04-2012, 03:59 AM
  2. clarification on fgetc definition
    By Satya in forum C Programming
    Replies: 5
    Last Post: 02-29-2012, 11:15 PM
  3. A clarification of my print function query
    By clinamen in forum C++ Programming
    Replies: 1
    Last Post: 03-10-2003, 12:21 PM
  4. Clarification on '::' definition and 'tilda' symbol
    By hugo in forum C++ Programming
    Replies: 2
    Last Post: 03-13-2002, 04:18 PM
  5. Clarification of Function Templates
    By biosx in forum C++ Programming
    Replies: 2
    Last Post: 02-20-2002, 11:42 AM

Tags for this Thread