Skip to main content
`Ctrl`+`K`

# PetscGetArguments

Allows you to access the command line arguments anywhere after `PetscInitialize()` is called but before `PetscFinalize()`.

## Synopsis

    #include "petscsys.h"
    PetscErrorCode PetscGetArguments(char ***args)

Not Collective, No Fortran Support

## Output Parameter

- args - the command line arguments

## Note

This does NOT start with the program name and IS `NULL` terminated (the final argument is void)

Use `PetscFreeArguments()` to return the memory used by the arguments.

This makes a copy of the arguments and the array of arguments, while `PetscGetArgs()` does not make a copy, it returns the array of arguments that was passed into the main program.

## See Also

`PetscFinalize()`, `PetscInitializeFortran()`, `PetscGetArgs()`, `PetscFreeArguments()`, `PetscInitialize()`

## Level

intermediate

## Location

src/sys/objects/pinit.c

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages