Course sections

1
Command Line Program for Odd Even
2
find the area of a circle when the diameter is given, using command line arguments
3
Factorial program in c using command line arguments.
4
Command Line Program to Convert Binary to Octal
5
Command Line Program to Convert Decimal to Octal
6
Write a c program, to check whether the given year is a leap year or not
7
find the GCD of the given 2 numbers, using command line arguments.
8
LCM of Two Numbers using Command Line Language
9
Sum of all the digits of a number using Command Line Language
10
Decimal to Binary using Command Line Argument
11
Command Line Program to find Area of Traingle
12
Command Line Program to find Area of Circle
13
Average of Two Numbers using Command Line Language
14
Command Line Program to check if a year is Leap Year or Not
15
Binary to decimal using Command Line Language
16
Command Line Program to Reverse a Number
17
Command Line Program to Check if a String is Palindrome or Not
18
Command Line Program to Check if a Number is Palindrome or Not
19
Command Line Program to Check if a Number is Prime or Not
20
Square Root of Prime Number using Command Line Argument
21
Nth Fibonacci Number using Command Line Argument
22
Calculate Square Root without using Math.h sqrt Function
23
Nth Fibonacci Number
24
Command Line Programming For Greatest of Two numbers
25
Command Line Program for Swapping two Numbers
26
Tcs Command Line Program for String Reversal
27
Fibonacci Series Program – Using Command Line Arguments
28
Factorial of a Non Negative Integer

Introduction

introduction to command line arguments

It is possible to pass some values from the command line to your C programs when they are executed. These values are called command line arguments.

We can’t use any input functions like scanf(), getch(), getchar().
The input to be provided should be read as command line arguments.

COMMAND LINE ARGUMENTS

int main(int argc, char *argv[])

COMMAND LINE ARGUMENTS IN C:

main() function of a C program accepts arguments from command
line or from other shell scripts by following commands.

They are argc and argv[]

where,

argc – Number of arguments in the command line
including program name (integer).
argv[] – This is carrying all the arguments including
program name (pointer array ).

Example of command line arguments

#include <stdio.h>

int main(int argc, char *argv[]) //command line arguments

{

printf(“\n Program name : %s \n”, argv[0]);

printf(“1st arg : %s \n”, argv[1]);

printf(“2nd arg : %s \n”, argv[2]);

return 0;

}

"<yoastmark

Properties of Command Line Arguments:

  1. They are passed to main() function.
  2. They are parameters/arguments supplied to the
    program when it is invoked.
  3. They are used to control program from outside
    instead of hard coding those values inside the code.
  4. argv[argc] is a NULL pointer.
  5. argv[0] holds the name of the program.
  6. argv[1] points to the first command line argument
    and argv[n] points last argument.

Here some easy problem that you can practice.


Regarding this course :

This course is an early bird release. More programs will be added in the coming days

If you are familiar with C programming, but you are not able to understand or write C program for a given problem, then this course helps in improving your coding skills.

In this course, 100 + C programs of different levels are explained clearly with pseudo code and tracing with sample inputs . After solving 100+ C programs, you will get a solid foundation in Coding.