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 |
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
What is advantage of pointer in c?
What is operator precedence?
What does the && operator do in a program code?
why should i select you?
console I/O functions means a) the I/O operations done on disk b) the I/O operations done in all parts c) the input given through keyboard is displayed VDU screen d) none of the above
What is string constants?
code for bubble sort?
Write program to remove duplicate in an array?
Can we include one C program into another C program if yes how?
What is main () in c?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.