How do I access command-line arguments?

Answers were Sorted based on User's Feedback



How do I access command-line arguments?..

Answer / srujana

we can access the command-line arguments by passing the
arguments argv and argc on to the main() function where
argv represents an array of pointers to strings and argc
holds the int value which is equal to the number of strings
that are in argv

Is This Answer Correct ?    10 Yes 1 No

How do I access command-line arguments?..

Answer / reejusri

In order to access the command arguments, the main()
function must have a prototype similar to the following.
int main(int argc, char * argv[])

The names argc and argv are usually used for the
parameters, but a programmer could use different names.

Is This Answer Correct ?    6 Yes 4 No

Post New Answer

More C Interview Questions

What type is sizeof?

0 Answers  


Define recursion in c.

0 Answers  


#include<stdio.h> void main() { int a,b,c; a=b=c=1; c=++a || ++b && ++c; printf("%d\t%d\t%d",a,b,c); }

3 Answers  


What does *p++ do? What does it point to?

0 Answers  


In c programming language, how many parameters can be passed to a function ?

0 Answers  






What is function pointer and where we will use it

2 Answers   Infosys, NetApp,


What is auto keyword in c?

0 Answers  


write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.

0 Answers   HCL,


What 'lex' does?

0 Answers   Tech Mahindra,


How variables are declared in c?

0 Answers  


what are advantages of U D F?

1 Answers   Google,


what is call by value and call by reference

4 Answers  


Categories