void main(int argc,char *argv[],char *env[])
{
int i;
for(i=1;i<argc;i++)
printf("%s",env[i]);
}
Answers were Sorted based on User's Feedback
Answer / gaurav
It’s interesting.
This program reads environmental variables. It is as same as
"env" command in unix.
But program is not proper. i.e. if you pass n arguments to
program, then it reads n environmental variables only.
Try this program
void main(int argc,char *argv[],char *env[])
{
int i;
if (2 <=argc){
for(i=0;i<atoi(argv[1]);i++)
printf("\n%s",env[i]);
}else printf("\nPlease enter no. of env variables you want
e.g. 'a.out 5'\n");
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / siddique
void main(int argc, char *argv[], char *env[])
{
int i=0;
while(env[i])
{
printf("%s\n", env[i]);
i++;
}
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Why do we use c for the speed of light?
Why c is procedure oriented?
What is the restrict keyword in C?
What is a class c rental property?
How can you access memory located at a certain address?
what is the difference between getch() and getchar()?
Why is this loop always executing once?
An application package has been provided to you without any documents for the following application. The application needs to be tested. How will you proceed?
which of the following go out of the loopo if expn 2 becoming false a.while(expn 1){...if(expn 2)continue;} b.while(!expn 1){if(expn 2)continue;...} c.do{..if(expn 1)continue;..}while(expn 2); d.while(!expn 2){if(expn 1)continue;..}
Explain the advantages and disadvantages of macros.
What is data structure in c programming?
what is difference between userlevel threads and kernel level threads ?what are the trades offs between these two approaches ? what approach is most frequently used and why ?