at present what is the default return type of a function?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • asif2057
    New Member
    • Jan 2013
    • 1

    at present what is the default return type of a function?

    i heard that it was int but later it is deprecated , so at present what is the default return type of a function ?
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Depends.

    In C if you don't specify a return type, int was assumed.

    In C++ there is no default return type.

    You are always better off specifying the correct return type. Remember, a function is an instance of it's return type. When you assign a function call to a variable, the compiler checks the return type to see if calling the function will produce a value that can be assigned to that variable.

    Comment

    • purush123
      New Member
      • Jan 2013
      • 1

      #3
      function return int by default.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        @purush123:

        Not in C++.

        Comment

        • swapnali143
          New Member
          • Mar 2012
          • 34

          #5
          function return int by default in C..
          But if you want to return any other value then you have to specify it in Function Protype

          Comment

          Working...