473,379 Members | 1,337 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,379 software developers and data experts.

what is the default return type of a function?

lgn
int or char or void? and how to check it?
thx!
Nov 13 '05 #1
4 9651
In article <bp***********@mail.cn99.com>, lgn wrote:
int or char or void? and how to check it?


You should always fully specify the return type of the functions
you write. In older standards, int was the default return type.
You check it by reading the standard document (not at my desk at
the moment so I can't quote it).
--
Andreas Kähäri
Nov 13 '05 #2
In <bp***********@mail.cn99.com> "lgn" <li*******@163.com> writes:
int or char or void? and how to check it?


By reading a C book.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #3
"Martin Ambuhl" <ma*****@earthlink.net> wrote in message
news:q5******************@newsread2.news.atl.earth link.net...
lgn wrote:
int or char or void? and how to check it?
thx!


Until 1999, a function without an explicit return type returned an int.
Since 1999, a function without an explicit return type is an error.


I think that's somewhat misleading. For the vast majority of C programmers,
implicit int is still a <cough>feature</cough> of our conforming compilers.
In other words, the C90 standard itself didn't change as a consequence of
C99. [Of course, sensible C programmers don't use implicit int without a
severe reason, e.g. gun to the head... :-)]

--
Peter
Nov 13 '05 #4
In <q5******************@newsread2.news.atl.earthlink .net> Martin Ambuhl <ma*****@earthlink.net> writes:
lgn wrote:
int or char or void? and how to check it?
thx!


Until 1999, a function without an explicit return type returned an int.
Since 1999, a function without an explicit return type is an error.


Compilers, however, haven't changed their behaviour on 1999-01-01.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

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...
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) {...
4
by: Sivakoti | last post by:
What is return type?how can we use it?
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.