O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example: A Linked List of Command-Line Arguments

A linked list needs two kinds of structure—a node to hold the information pertaining to the list management and an area containing the data that is associated with this node. This example starts with the payload struct—the data that you want to store in each node of the list.

Assume for this example that you want to store pairs of values representing command-line arguments. So you can create a struct in C as follows:

typedef struct
    {

        char szParameterName[255];
        char szValue[255];

    } sParameter;

In Chapter 9, you learned how to parse the command line and saw an example whereby each parameter could be specified as a pair of strings:

-<parameter name> [["]<value>["]]

In parsing this example, each parameter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required