void main(int argc,char *argv[],char *env[])
{
int i;
for(i=1;i<argc;i++)
printf("%s",env[i]);
}
Answer Posted / 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 |
Post New Answer View All Answers
What is time complexity c?
Explain how do you generate random numbers in c?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
What are the data types present in c?
What is const and volatile in c?
What is header file in c?
Write a program to print “hello world” without using semicolon?
How can I change their mode to binary?
Are there namespaces in c?
What is the difference between c and python?
Why is c fast?
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Explain the difference between malloc() and calloc() function?
What is the difference between the local variable and global variable in c?