Re: What declarations of main exist in the c standard?
- From: "Mark" <sober@xxxxxxxxxxxx>
- Date: Mon, 06 Jun 2005 17:22:38 GMT
"Eric Sosman" <esosman@xxxxxxxxxxxxxxxxxxx> wrote in message
news:C-udnTvjjoEBYz_fRVn-qw@xxxxxxxxxxxxxx
> bjrnove wrote:
>> Hi.
>>
>> Me and a friend have a discussion about main. In my opinion the legal
>> ways of writing main is:
>>
>> int main(void);
>> int main(int,char**);
>>
>> My friend claims that you also have a standard version with enviroment
>> variables like this:
>> int main(int,char**,char**);
>>
>> Is that right or are my two versions the only standard c way to do it?
>
> The Standard guarantees that any hosted C implementation
> must accept your two forms. The Standard allows an implementation
> to accept other forms, too, but does not describe any of those
> implementation-specific alternative forms
<snip>
Actually, it does 'describe' one of those 'other forms'.
J.5.1 Environment arguments
[#1] In a hosted environment, the main function receives a
third argument, char *envp[], that points to a null-
terminated array of pointers to char, each of which points
to a string that provides information about the environment
for this execution of the program (5.1.2.2.1).
.
- Follow-Ups:
- Re: What declarations of main exist in the c standard?
- From: Eric Sosman
- Re: What declarations of main exist in the c standard?
- References:
- What declarations of main exist in the c standard?
- From: bjrnove
- Re: What declarations of main exist in the c standard?
- From: Eric Sosman
- What declarations of main exist in the c standard?
- Prev by Date: Re: How to read data from an excel file by C?
- Next by Date: Checking endianess in compile time
- Previous by thread: Re: What declarations of main exist in the c standard?
- Next by thread: Re: What declarations of main exist in the c standard?
- Index(es):
Relevant Pages
|
Loading