Share this page

# auto

A Storage-Class Specifier used within a function. A local function variable declared with auto has a local lifetime. This is the default.

## Example

The following example shows an auto variable,retry, being used in a for loop.

Copy code

        #define MAX_RETRIES 5
        static int logon_done = 0;
        auto int retry; // Attempt to logon MAX_TRIES
        if (!logon_done) {
            // logon to server here and break out of loop if successful
            for (retry=0; retry<MAX_RETRIES; retry++)
                lr_output_message ("Retry number %d", retry);
            logon_done = 1;
        }

    Example: Output:
    Action.c(12): Retry number 0
    Action.c(12): Retry number 1
    Action.c(12): Retry number 2
    Action.c(12): Retry number 3
    Action.c(12): Retry number 4

Tips to improve your search results... VuGen Function Reference Version 26.1-26.3 Function Reference 26.1-26.3 All View Local Help Center View Online Help Center Version: