Share this page

# Example: const

In the following example, const modifies a formal parameter of a function declaration. An actual parameter passed as i cannot be modified by the function my_itoa.

    /* Function description: my_itoa converts the integer i to a string s */
        char * my_itoa( const int i, char * s) {
            sprintf (s, "%d", i);
            return s;
        }

        int x = 5;
        char str[16];
        my_itoa(x, str);
        lr_output_message ("my_itoa returned %s", str);

    Example: Output:
    Action.c(8): my_itoa returned 5

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