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 is pragma c?

0 Answers  


Write a program to print the prime numbers from 1 to 100?

7 Answers  


develop algorithms to add polynomials (i) in one variable

0 Answers   Ignou, TCS,


where do we use structure pointer?

1 Answers  


Find the O/p of the following struct node { char *name; int num; }; int main() { struct node s1={"Harry",1331}; struct node s2=s1; if(s1==s2) printf("Same"); else printf("Diff"); }

1 Answers  






What are the types of arrays in c?

0 Answers  


What is 2c dna?

0 Answers  


How. To pass the entrance test

1 Answers   Tech Mahindra,


Why is event driven programming or procedural programming, better within specific scenario?

0 Answers   Wipro,


Why c is faster than c++?

0 Answers  


What are the __date__ and __time__ preprocessor commands?

0 Answers  


What is structure packing ?

2 Answers   HP,


Categories