Beginning C character array explanation I have been following along the book 'The C Programming Language' 2nd edition by Kernighan and Ritchie. The below code is an exercise from the book. What I am confused about in this code is the Character array 'line'. It is a local variable so I don't understand how the value is changing when it is used as an argument in the 'get_line' function. 

/*******************************
 * Author:                     *
 * Date: 4/22/2019             *
 * Purpose: Book exercise      *
 *******************************/

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

#define MAX_LINE 1000

int get_line(char line[], int maxline);
void copy(char to[], char from[]);

/*Print longest input line*/
int main()
{
    int len;    //Current line length
    int max;    //Maximum length seen so far

    char line[MAX_LINE];        //Current input line
    char longest[MAX_LINE];     //Longest line saved here

    max = 0;

    //While input length is greater than 0
    while((len = get_line(line, MAX_LINE)) &gt; 0)
    {
        //If current string is longer than max
        if (len &gt; max)
        {
            max = len;              //Assign new max value
            copy(longest, line);    //Replace longest string value with current string
        }
    }

    if (max &gt; 0)
    {
        printf("%s", longest);
    }
    return 0;
}

int get_line(char s[], int lim)
{
    int c, i;

    /*i = 0; i less than limit - 1 *and* input is not EOF *and* input is not enter key */
    for (i=0; i&lt;lim - 1 &amp;&amp; (c=getchar())!=EOF &amp;&amp; c!='\n'; i++)
    {
        s[i] = c; // input array position i is = input
    }

    //Once enter key is hit
    if (c == '\n')
    {
        s[i] = c;   //Add enter key '\n' onto array
        i++;        //Incr i so that last char can be '\0' later
    }

    s[i] = '\0';    //The last spot on char array is '\0'
    return i;
}

void copy(char to[], char from[])
{
    int i;

    i = 0;

    //Assign from[i] to to[i] until null terminator
    while((to[i] = from[i]) != '\0')
    {
        i++;
    }
}


For example if I had a variable in the main routine

int add_num(int num1);
main()
{
    int x = 5;
    add_num(x);
    printf("%d", x);
}

int add_num(int num1)
{
    num1 += 5;
    return num1;
}


x would still remain equal to 5 unless I did:

x = add_num(x);


then x would equal 10.

So how does the line character array change when the function that it's used in returns 'i'?
Where I is the length of the string entered.

Sorry if this was a little long, but I wanted to explain myself clearly.
From the end of the chapter 1.8:


  "When the name of an array is used as an argument, the value passed to
  the function is the location or address of the beginning of the array
  - there is no copying of array elements. By subscripting this value, the function can access and alter any element of the array".


So, when you pass array as an argument to a function, you don't create a local copy of array. Instead, you create a pointer (Chapter 5) and work with it as with an array.