473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 ?
Jan 17 '13 #1
4 1408
weaknessforcats
9,208 Expert Mod 8TB
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.
Jan 17 '13 #2
function return int by default.
Jan 18 '13 #3
weaknessforcats
9,208 Expert Mod 8TB
@purush123:

Not in C++.
Jan 18 '13 #4
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
Jan 24 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Murat Tasan | last post by:
so i have a situation that i know cannot be solved directly, and i've already worked around it, but i was hoping to find an explanation as to why this behavior is as it is... i have an abstract...
4
by: aling | last post by:
What's the rule of default argument of function in C++? I found that the default argument of function could not necessary be a constant value. Is it true? Previously I thought that the default...
2
by: lgn | last post by:
int or char or void? and how to check it? thx!
10
by: geoffblanduk_nospam | last post by:
Just curious, we no longer require void on a method that takes no parameters; void methodWithNoParameters(void) has been replaced by void methodWithNoParameters(). Is there a good reason we...
4
by: breathwell | last post by:
Consider a C# function that logs an error string and returns a new Exception object: System.Exception LogError(string msg) { ... return new Exception(msg); }
31
by: CeZaR | last post by:
Hi, How can i specify the return type of a function returning a managed array of chars. If i try to write: "char __gc func()" i get an error! How can i do that? Thanks!
5
by: Harold Hsu | last post by:
Hi all, What's the default access type of a property declared in an interface? The one I'm looking at is IBindingList: Public Interface IBindingList .... ReadOnly Property AllowEdit As...
3
by: C++ | last post by:
According to Thinking in C++ "You cannot modify the return type of a virtual function during overriding.but there is a special case in which you can slightly modify the return type. If you¡¯re...
5
by: PsiX | last post by:
Hi, does the return type specifier const for functions for built-in types ever make sense? Like in: const void DoSth(); const int DoSth();
18
by: Carl Forsman | last post by:
there are 2 ways to return a value from a function ==================== 1) passing a reference as parameter - the following will return time void Table::Get(char* FieldName, *SYSTEMTIME time) {...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.