473,607 Members | 2,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

whats the use of third argument to main( )

hi,

whats the use of third argument to main( ), i.e. environmental
parameters.... if i am not wrong ? 1st 1 is argc 2nd is argv and what
bout the 3rd 1???????????

sushant

Nov 14 '05 #1
6 3103
th********@redi ffmail.com writes:
whats the use of third argument to main( ), i.e. environmental
parameters.... if i am not wrong ? 1st 1 is argc 2nd is argv and what
bout the 3rd 1???????????


The C standard specifies that main can take no arguments:
int main(void)
or two arguments:
int main(int argc, char **argv)

Implementations are allowed to accept other forms, but such forms are
non-standard and should probably be discussed in a newsgroup specific
to the system you're using.

One common extension is to accept a third argument that points to the
environment:
int main(int argc, char **argv, char **envp)

The standard getenv() function provides some, but not all, of the
functionality of this third argument. Some systems also make it
available as an external variable called "environ". It's a pointer to
an array of pointers to strings, each of the string represents an
environment variable.

Code intended to be maximally portable should only access the
environment through the getenv() function.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #2
thnx Keith for ur info .... can u elaborate on wht u mean by
environment variables?

Nov 14 '05 #3
Up spake th********@redi ffmail.com:
thnx Keith for ur info .... can u elaborate on wht u mean by
environment variables?


http://www.justfuckinggoogleit.com/
Nov 14 '05 #4
<th********@red iffmail.com> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
thnx Keith for ur info .... can u elaborate on wht u mean by
environment variables?


Some, but not all, operating systems provide 'environment
variables' as a configuration mechanism, typically providing
'global' data available to applications. If your operating
system has them (e.g. MS-DOS and Windows have them), you
can learn more by reading its documentation.

-Mike
Nov 14 '05 #5
Neo

<th********@red iffmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
hi,

whats the use of third argument to main( ), i.e. environmental
parameters.... if i am not wrong ? 1st 1 is argc 2nd is argv and what
bout the 3rd 1???????????

sushant


main() can take at most two arguments.
int main(int argc, char *argv[])
{
.....
}

There no third argument to main() in C.
That can be some non-std. feature (implementation defined) which you may be
talking of. Sorry C doesnt have such thing.

-Neo
Nov 14 '05 #6
<posted & mailed>

th********@redi ffmail.com wrote:
hi,

whats the use of third argument to main( ), i.e. environmental
parameters.... if i am not wrong ? 1st 1 is argc 2nd is argv and what
bout the 3rd 1???????????
In C, main() takes at most 2 arguments.


sushant


--
Remove '.nospam' from e-mail address to reply by e-mail
Nov 14 '05 #7

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

Similar topics

3
2025
by: Muhd | last post by:
<usualDisclaimer>Please forgive me if this is in the wrong group, and if so, what is the right group.</usualDisclaimer> Let me start off by first saying im a newb. Ok, with that out of the way I am trying really hard and boy have I learned a lot in the last little while but I have a question i just can't seem to find a good answer to. Lets say i have a table that simply stores how many times someone has logged into a webpage. Is it...
2
1470
by: David | last post by:
I am stumped ..how do I use the flag (secton c) INHERITANCE (a) Create a class Car that conatins two integer fields. One holds a flag indicating whether the ignition is on; the other holds the Car's current speed in miles per hour. There are four member functions: two functions that turns the igition on and off, a setSpeedO
5
1689
by: Booted Cat | last post by:
I've seen lots of discussions on the proposed inclusion of "function call with named arguments" to C/C++ on these newsgroups. My proposal is slightly different in that: * No ANSI approval is needed * No conflicts with existing language features such as function overloading * No need to modify the language spec or the compiler * No need to modify your source code
20
2428
by: Snis Pilbor | last post by:
Whats the point of making functions which take arguments of a form like "const char *x"? It appears that this has no effect on the function actually working and doing its job, ie, if the function doesn't write to x, then it doesnt seem like the compiler could care less whether I specify the const part. Quite the opposite, if one uses const liberally and then later goes back and changes the functions, headaches will inevitably occur as...
3
2775
by: zhang.yongpeng | last post by:
Hello, I met some problems when trying to sort a list that has shared_ptr in it. here is the non-compliable code. test.cpp: /********************* begin of code *************************/ #include <boost/shared_ptr.hpp> #include <list> class T{ // simplified this class to the simplest form public: T(int t):capacity(t){}
5
3031
by: sam | last post by:
HI, Whats the meaning of this code:- char buff; memset(buff, 'A' , 100); sometimes we can place hex value in place of 'A' like 0x90c but how this code function actually. thanks in advance
10
2347
by: joestevens232 | last post by:
Ok everything is good...I read in all my grades into each of the different arrays that they need to go in. Now Im trying to write a function that takes the grades and computes the average on a hundred point scale...for example: Student 1 7 quiz scores 9 9.33 8 10 5.5 8 10 ==> the 5.5 score should be dropped, returned value: 90.55 6 project scores 20 47.5 47 45 47.5 48 ==> returned value: 94.44 2 exam scores 83 87 ==>...
1
1693
thatos
by: thatos | last post by:
When I run this program import au.id.jericho.lib.html.*; import java.util.*; import java.io.*; import java.net.*; public class DisplayAllElements { public static void main(String args) throws Exception { String sourceUrlString="data/test.html";
2
1945
by: manjuks | last post by:
Hi All, int bind(int SOCKFD, struct sockaddr *MYADDR, int ADDRLEN); In the above system call, the third argument is the length of socket address structure. My question is why we need third argument? since we are passing second parameter as pointer to socket address structure, so it can calculate itself the length of the structure. Thanks, Manjunath
0
8050
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8464
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6805
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3954
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4015
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2464
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1318
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.