18.2.224. PMIx_Argv_count

PMIx_Argv_count — Count the number of entries in a NULL-terminated argv-style array of strings.

18.2.224.1. SYNOPSIS

#include <pmix.h>

int PMIx_Argv_count(char **a);

18.2.224.1.1. Python Syntax

No Python equivalent

18.2.224.2. INPUT PARAMETERS

  • a: Pointer to a NULL-terminated array of char * strings, or NULL.

18.2.224.3. DESCRIPTION

Return the number of string entries contained in the argv-style array a. The count is obtained by walking the array from its first element until the terminating NULL pointer is reached; the terminating NULL itself is not included in the count.

The array is not modified, and none of the contained strings are examined beyond the pointers themselves.

18.2.224.4. RETURN VALUE

Returns the number of non-NULL entries in the array. If a is NULL, the function returns 0.

18.2.224.5. EXAMPLES

char **argv = NULL;

PMIx_Argv_append_nosize(&argv, "alpha");
PMIx_Argv_append_nosize(&argv, "beta");

int n = PMIx_Argv_count(argv);   /* n == 2 */