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 |
What is a example of a variable?
write a program to input 10 strings and compare without using strcmp() function. If the character of one string matches with the characters of another string , sort them and make it a single string ??? example:- str1="Aakash" st2="Himanshu" str="Uday" output:- Aakashimanshuday (please post the answer as quickly as possible)
Write a C program to convert an integer into a binary string?
no consistent academics. how to answer the question
Are enumerations really portable?
What is a program?
how to get starting address of a running C program
Write a program that can show the multiplication table.
code for selection sort?
Explain the difference between #include "..." And #include <...> In c?
What is the difference between int main and void main in c?
What is the use of #define preprocessor in c?