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
#include
hi, which software companys will take,if d candidate's % is jst 55%?
What are structure members?
What does stand for?
Explain what is wrong in this statement?
Explain how does free() know explain how much memory to release?
How can I find the modification date of a file?
What is a stream in c programming?
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
How can I list all of the predefined identifiers?
what will be maximum number of comparisons when number of elements are given?
What is wrong with this program statement?
If null and 0 are equivalent as null pointer constants, which should I use?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.