How do I access command-line arguments?
Answers were Sorted based on User's Feedback
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 |
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 |
Is r written in c?
A program to write a number of letters and numbers, such as counting and display
main() { charx; while (x=0;x<=255;x++) printf("\nAscii value %d Character %c,x,x); }
#include<stdio.h> int main( ) { Int a=300, b, c; if(a>=400) b=300; c=200; printf(“%d%d ”, b, c); return0; }
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
Write the Program to reverse a string using pointers.
What is the use of the restrict keyword?
Differentiate between the expression “++a” and “a++”?
i want the code for printing the output as follows 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4
Write the program for displaying the ten most frequent words in a file such that your program should be efficient in all complexity measures.
#include<stdio.h> main() { int a[3]; int *I; a[0]=100;a[1]=200;a[2]=300; I=a; Printf(“%d\n”, ++*I); Printf(“%d\n”, *++I); Printf(“%d\n”, (*I)--); Printf(“%d\n”, *I); } what is the o/p a. 101,200,200,199 b. 200,201,201,100 c. 101,200,199,199 d. 200,300,200,100