Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Zilla+Slab&display=swap" rel="stylesheet">
</head>
<body>
  <nav class="navigation" id="navbar">
    <header id="main-header">C Programming Language</header>
    <ul class="navlist">
      <li><a class="nav-link" href="#introduction">Introduction</a></li>
      <li><a class="nav-link" href="#program_structure">Program Structure</a></li>
      <li><a class="nav-link" href="#basic_syntax">Basic Syntax</a></li>
      <li><a class="nav-link" href="#data_types">Data Types</a></li>
      <li><a class="nav-link" href="#variables">Variables</a></li>
      <li><a class="nav-link" href="#constants_and_literals">Constants and Literals</a></li>
      <li><a class="nav-link" href="#storage_classes">Storage Classes</a></li>
      <li><a class="nav-link" href="#decision_making">Decision Making</a></li>
      <li><a class="nav-link" href="#loops">Loops</a></li>
      <li><a class="nav-link" href="#functions">Functions</a></li>
      <li><a class="nav-link" href="#arrays">Arrays</a></li>
      <li><a class="nav-link" href="#reference">Reference</a></li>
    </ul>
  </nav>
  <main id="main-doc">
    <section class="main-section" id="introduction">
      <header>Introduction</header>
      <article>
        <p>C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1972.</p>
        <p>In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available description of C, now known as the K&R standard.</p>
        <p>The UNIX operating system, the C compiler, and essentially all UNIX application programs have been written in C. C has now become a widely used professional language for various reasons:</p>
        <ul>
          <li>Easy to learn</li>
          <li>Structured language</li>
          <li>It produces efficient programs</li>
          <li>It can handle low-level activities</li>
          <li>It can be compiled on a variety of computer platforms</li>
        </ul>
        <h4>Why use C?</h4>
        <p>C was initially used for system development work, particularly the programs that make-up the operating system. C was adopted as a system development language because it produces code that runs nearly as fast as the code written in assembly language. Some examples of the use of C might be:</p>
        <ul>
          <li>Operating Systems</li>
          <li>Language Compilers</li>
          <li>Assemblers</li>
          <li>Text Editors</li>
          <li>Print Spoolers</li>
          <li>Network Drivers</li>
          <li>Databases</li>
        </ul>
        <h4>C Programs</h4>
        <p>A C program can vary from 3 lines to millions of lines and it should be written into one or more text files with extension ".c"; for example, hello.c. You can use "vi", "vim" or any other text editor to write your C program into a file.</p>
      </article>
    </section>
    <section class="main-section" id="program_structure">
      <header>Program Structure</header>
      <article>
        <p>Before we study the basic building blocks of the C programming language, let us look at a bare minimum C program structure so that we can take it as a reference in the upcoming chapters.</p>
        <h4>Hello World Example</h4>
        <p>A C program basically consists of the following parts:</p>
        <ul>
          <li>Preprocessor Commands</li>
          <li>Functions</li>
          <li>Variables</li>
          <li>Statements & Expressions</li>
          <li>Comments</li>
        </ul>
        <p>Let us look at a simple code that would print the words "Hello World":</p>
       <pre><code>
#include &lt;stdio.h&gt;
   
int main() {
/* my first program in C */
printf("Hello, World! \n");
   
return 0;
}
          </code>
          </pre>
        <p>Let us take a look at the various parts of the above program. The first line of the program #include &lt;stdio.h&gt; is a preprocessor command, which tells a C compiler to include stdio.h file before going to actual compilation.The next line int main() is the main function where the program execution begins.The next line /*...*/ will be ignored by the compiler and it has been put to add additional comments in the program. So such lines are called comments in the program.The next line printf(...) is another function available in C which causes the message "Hello, World!" to be displayed on the screen.The next line return 0; terminates the main() function and returns the value 0.</p>
      </article>
    </section>
    <section class="main-section" id="basic_syntax">
      <header>Basic Syntax</header>
      <article>
        <p>You have seen the basic structure of a C program, so it will be easy to understand other basic building blocks of the C programming language.</p>
        <h4>Tokens in C</h4>
        <p>A C program consists of various tokens and a token is either a keyword, an identifier, a constant, a string literal, or a symbol. For example, the following C statement consists of five tokens:</p>
        <pre> <code>printf("Hello, World! \n");</code></pre>
        <p>The individual tokens are:</p>
        <pre><code>
printf
(
   "Hello, World! \n"
)
;
</code></pre>
        <h4>Semicolons</h4>
        <p>In a C program, the semicolon is a statement terminator. That is, each individual statement must be ended with a semicolon. It indicates the end of one logical entity.
          Given below are two different statements:</p>
        <pre><code>
printf("Hello, World! \n");
return 0;
</code></pre>
        <h4>Comments</h4>
        <p>Comments are like helping text in your C program and they are ignored by the compiler. They start with /* and terminate with the characters */ as shown below:</p>
        <pre><code>
/* my first program in C */
</code></pre>
        <p>You cannot have comments within comments and they do not occur within a string or character literals.</p>
        <h4>Identifiers</h4>
        <p>A C identifier is a name used to identify a variable, function, or any other user-defined item. An identifier starts with a letter A to Z, a to z, or an underscore '_' followed by zero or more letters, underscores, and digits (0 to 9).

C does not allow punctuation characters such as @, $, and % within identifiers. C is a <b>case-sensitive</b> programming language. Thus, <i>Manpower</i> and <i>manpower</i> are two different identifiers in C. Here are some examples of acceptable identifiers:</p>
<pre><code>
mohd       zara    abc   move_name  a_123
myname50   _temp   j     a23b9      retVal
</code></pre>
        <h4>Keywords</h4>
        <p>The following list shows the reserved words in C. These reserved words may not be used as constants or variables or any other identifier names.</p>
        <pre><code>
auto	   else	   long	    switch
break	   enum	   register typedef
case	   extern  return   union
char	   float   short    unsigned
const	   for	   signed   void
continue   goto    sizeof   volatile
default	   if	   static   while
do         int	   struct   _Packed
double	
        </code></pre>
        <h4>Whitespace in C</h4>
        <p>A line containing only whitespace, possibly with a comment, is known as a blank line, and a C compiler totally ignores it.

Whitespace is the term used in C to describe blanks, tabs, newline characters and comments. Whitespace separates one part of a statement from another and enables the compiler to identify where one element in a statement, such as int, ends and the next element begins. Therefore, in the following statement:</p>
        <pre><code>
int age;
</code></pre>
        <p>there must be at least one whitespace character (usually a space) between int and age for the compiler to be able to distinguish them. On the other hand, in the following statement:</p>
        <pre><code>
fruit = apples + oranges;   // get the total fruit
</code></pre>
        <p>no whitespace characters are necessary between fruit and =, or between = and apples, although you are free to include some if you wish to increase readability.</p>
      </article>
    </section>
    <section class="main-section" id="data_types">
      <header>Data Types</header>
      <article>
        <p>Data types in c refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted.The types in C can be classified as follows:</p>
        <ol>
          <li><b>Basic Types:</b>They are arithmetic types and are further classified into: (a) integer types and (b) floating-point types.</li>
          <li><b>Enumerated types:</b>They are again arithmetic types and they are used to define variables that can only assign certain discrete integer values throughout the program.</li>
          <li><b>The type void:</b>The type specifier void indicates that no value is available.</li>
          <li><b>Derived types:</b>They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types and (e) Function types.</li>
        </ol>
        <p>The array types and structure types are referred collectively as the aggregate types. The type of a function specifies the type of the function's return value. We will see the basic types in the following section, where as other types will be covered in the upcoming chapters.</p>
        <h4>Integer Types</h4>
        <p>The following provides the details of standard integer types with their value ranges:</p>
        <ul class="integer">
          <li><b>char:</b>-128 to 127 or 0 to 255</li>
          <li><b>unsigned char:</b>0 to 255</li>
          <li><b>signed char:</b>128 to 127</li>
          <li><b>int:</b>-32,768 to 32,767 or -2,147,483,648 to 2,147,483,647</li>
          <li><b>unsigned int:</b>0 to 65,535 or 0 to 4,294,967,295</li>
          <li><b>short:</b>-32,768 to 32,767</li>
          <li><b>unsigned short:</b>0 to 65,535</li>
          <li><b>long:</b>-9223372036854775808 to 9223372036854775807</li>
          <li><b>unsigned long:</b>0 to 18446744073709551615</li>
        </ul>
        <p>To get the exact size of a type or a variable on a particular platform, you can use the sizeof operator. The expressions sizeof(type) yields the storage size of the object or type in bytes.</p>
        <h4>Floating-Point Types</h4>
        <p>The following provide the details of standard floating-point types with value ranges and their precision:</p>
        <ul>
          <li><b>float:</b>1.2E-38 to 3.4E+38 | 6 decimal places </li>
          <li><b>double:</b>2.3E-308 to 1.7E+308 | 15 decimal places</li>
          <li><b>long double:</b>3.4E-4932 to 1.1E+4932 | 19 decimal places</li>
        </ul>
        <p>The header file float.h defines macros that allow you to use these values and other details about the binary representation of real numbers in your programs.</p>
        <h4>The void Type</h4>
        <p>The void type specifies that no value is available. It is used in three kinds of situations:</p>
        <ol>
          <li><b>Function returns as void:</b>There are various functions in C which do not return any value or you can say they return void. A function with no return value has the return type as void. For example,<b> void exit (int status);</b></li>
          <li><b>Function arguments as void:</b>There are various functions in C which do not accept any parameter. A function with no parameter can accept a void. For example,<b> int rand(void);</b></li>
          <li><b>Pointers to void:</b>A pointer of type void * represents the address of an object, but not its type. For example, a memory allocation function <b>void *malloc( size_t size );</b> returns a pointer to void which can be casted to any data type.</li>
        </ol>
      </article>
    </section>
    <section class="main-section" id="variables">
      <header>Variables</header>
      <article>
        <p>A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable.

The name of a variable can be composed of letters, digits, and the underscore character. It must begin with either a letter or an underscore. Upper and lowercase letters are distinct because C is case-sensitive. Based on the basic types explained in the previous chapter, there will be the following basic variable types:</p>
        <ol>
          <li><b>char:</b>Typically a single octet(one byte). It is an integer type.</li>
          <li><b>int:</b>The most natural size of integer for the machine.</li>
          <li><b>float:</b>A single-precision floating point value.</li>
          <li><b>double:</b>A double-precision floating point value.</li>
          <li><b>void:</b>Represents the absence of type.</li>
        </ol>
        <p>C programming language also allows to define various other types of variables, like Enumeration, Pointer, Array, Structure, Union, etc. </p>
        <h4>Variable Definition in C</h4>
        <p>A variable definition tells the compiler where and how much storage to create for the variable. A variable definition specifies a data type and contains a list of one or more variables of that type as follows:</p>
        <pre><code>
type variable_list;
</code></pre>
        <p>Here, <b>type</b> must be a valid C data type including char, w_char, int, float, double, bool, or any user-defined object; and <b>variable_list</b> may consist of one or more identifier names separated by commas. Some valid declarations are shown here:</p>
        <pre><code>
int    i, j, k;
char   c, ch;
float  f, salary;
double d;
</code></pre>
        <p>The line <b>int i, j, k;</b> declares and defines the variables i, j, and k; which instruct the compiler to create variables named i, j and k of type int. Variables can be initialized (assigned an initial value) in their declaration. The initializer consists of an equal sign followed by a constant expression as follows:</p>
        <pre><code>
type variable_name = value;
</code></pre>
        <p>Some examples are:</p>
        <pre><code>
extern int d = 3, f = 5;    // declaration of d and f. 
int d = 3, f = 5;           // definition and initializing d and f. 
byte z = 22;                // definition and initializes z. 
char x = 'x';               // the variable x has the value 'x'.
</code></pre>
        <p>For definition without an initializer: variables with static storage duration are implicitly initialized with NULL (all bytes have the value 0); the initial value of all other variables are undefined.</p>
        <h4>Variable Declaration in C</h4>
        <p>A variable declaration provides assurance to the compiler that there exists a variable with the given type and name so that the compiler can proceed for further compilation without requiring the complete detail about the variable. A variable definition has its meaning at the time of compilation only, the compiler needs actual variable definition at the time of linking the program.</p>
        <p>

A variable declaration is useful when you are using multiple files and you define your variable in one of the files which will be available at the time of linking of the program. You will use the keyword<b> extern</b> to declare a variable at any place. Though you can declare a variable multiple times in your C program, it can be defined only once in a file, a function, or a block of code.</p>
      </article>
    </section>
    <section class="main-section" id="constants_and_literals">
      <header>Constants and Literals</header>
      <article>
        <p>Constants refer to fixed values that the program may not alter during its execution. These fixed values are also called literals.

Constants can be of any of the basic data types like an integer constant, a floating constant, a character constant, or a string literal. There are enumeration constants as well.

Constants are treated just like regular variables except that their values cannot be modified after their definition.</p>
        <h4>Integer Literals</h4>
        <p>An integer literal can be a decimal, octal, or hexadecimal constant. A prefix specifies the base or radix: 0x or 0X for hexadecimal, 0 for octal, and nothing for decimal.

An integer literal can also have a suffix that is a combination of U and L, for unsigned and long, respectively. The suffix can be uppercase or lowercase and can be in any order. Here are some examples of integer literals:</p>
        <pre><code>
212         /* Legal */
215u        /* Legal */
0xFeeL      /* Legal */
078         /* Illegal: 8 is not an octal digit */
032UU       /* Illegal: cannot repeat a suffix */
</code></pre>
        <h4>Floating-point Literals</h4>
        <p>A floating-point literal has an integer part, a decimal point, a fractional part, and an exponent part. You can represent floating point literals either in decimal form or exponential form.

While representing decimal form, you must include the decimal point, the exponent, or both; and while representing exponential form, you must include the integer part, the fractional part, or both. The signed exponent is introduced by e or E. Here are some examples of floating-point literals:</p>
        <pre><code>
3.14159       /* Legal */
314159E-5L    /* Legal */
510E          /* Illegal: incomplete exponent */
210f          /* Illegal: no decimal or exponent */
.e55          /* Illegal: missing integer or fraction */
        </code></pre>
        <h4>Character Constants</h4>
        <p>Character literals are enclosed in single quotes, e.g., 'x' can be stored in a simple variable of char type.

A character literal can be a plain character (e.g., 'x'), an escape sequence (e.g., '\t'), or a universal character (e.g., '\u02C0').

There are certain characters in C that represent special meaning when preceded by a backslash for example, newline (\n) or tab (\t).</p>
        <h4>String Literals</h4>
        <p>String literals or constants are enclosed in double quotes "". A string contains characters that are similar to character literals: plain characters, escape sequences, and universal characters.

You can break a long line into multiple lines using string literals and separating them using white spaces.Here are some examples of string literals. All the three forms are identical strings.</p>
        <pre><code>
"hello, dear"

"hello, \

dear"

"hello, " "d" "ear"
</code></pre>
      </article>
    </section>
    <section class="main-section" id="storage_classes">
      <header>Storage Classes</header>
      <article>
        <p>A storage class defines the scope (visibility) and life-time of variables and/or functions within a C Program. They precede the type that they modify. We have four different storage classes in a C program:</p>
        <ul>
          <li>auto</li>
          <li>register</li>
          <li>static</li>
          <li>extern</li>
        </ul>
        <h4>The auto Storage Class</h4>
        <p>The auto storage class is the default storage class for all local variables.</p>
        <pre><code>
{
   int mount;
   auto int month;
}
</code></pre>
        <p>The example above defines two variables with in the same storage class. 'auto' can only be used within functions, i.e., local variables.</p>
        <h4>The register Storage Class</h4>
        <p>The register storage class is used to define local variables that should be stored in a register instead of RAM. This means that the variable has a maximum size equal to the register size (usually one word) and can't have the unary '&amp;' operator applied to it (as it does not have a memory location).</p>
        <pre><code>
{
   register int  miles;
}
</code></pre>
        <p>The register should only be used for variables that require quick access such as counters. It should also be noted that defining 'register' does not mean that the variable will be stored in a register. It means that it MIGHT be stored in a register depending on hardware and implementation restrictions.</p>
        <h4>The static Storage Class</h4>
        <p>The static storage class instructs the compiler to keep a local variable in existence during the life-time of the program instead of creating and destroying it each time it comes into and goes out of scope. Therefore, making local variables static allows them to maintain their values between function calls.

The static modifier may also be applied to global variables. When this is done, it causes that variable's scope to be restricted to the file in which it is declared.

In C programming, when static is used on a global variable, it causes only one copy of that member to be shared by all the objects of its class.</p>
        <h4>The extern Storage Class</h4>
        <p>The extern storage class is used to give a reference of a global variable that is visible to ALL the program files. When you use 'extern', the variable cannot be initialized however, it points the variable name at a storage location that has been previously defined.

When you have multiple files and you define a global variable or function, which will also be used in other files, then extern will be used in another file to provide the reference of defined variable or function. Just for understanding, extern is used to declare a global variable or function in another file.

The extern modifier is most commonly used when there are two or more files sharing the same global variables or functions.</p>
      </article>
    </section>
    <section class="main-section" id="decision_making">
      <header>Decision Making</header>
      <article>
        <p>Decision making structures require that the programmer specifies one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.

Show below is the general form of a typical decision making structure found in most of the programming languages:</p>
        <div id="graph3">
          <img src="https://www.tutorialspoint.com/cprogramming/images/decision_making.jpg" alt="decision making graph">
        </div>
        <p>C programming language assumes any non-zero and non-null values as true, and if it is either zero or null, then it is assumed as false value.

          C programming language provides the following types of decision making statements.</p>
        <ol>
          <li><b>if statement:</b>An if statement consists of a boolean expression followed by one or more statements.</li>
          <li><b>if...else statement:</b>An if statement can be followed by an optional else statement, which executes when the Boolean expression is false.</li>
          <li><b>nested if statements:</b>You can use one if or else if statement inside another if or else if statement(s).</li>
          <li><b>switch statement:</b>A switch statement allows a variable to be tested for equality against a list of values.</li>
          <li><b>nested switch statements:</b>You can use one switch statement inside another switch statement(s).</li>
        </ol>
      </article>
    </section>
    <section class="main-section" id="loops">
      <header>Loops</header>
      <article>
        <p>You may encounter situations, when a block of code needs to be executed several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on.

Programming languages provide various control structures that allow for more complicated execution paths.

          A loop statement allows us to execute a statement or group of statements multiple times. C programming language provides the following types of loops to handle looping requirements. </p>
        <ol>
          <li><b>while loop:</b>Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body.</li>
          <li><b>for loop:</b>Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.</li>
          <li><b>do...while loop:</b>It is more like a while statement, except that it tests the condition at the end of the loop body.</li>
          <li><b>nested loops:</b>You can use one or more loops inside any other while, for, or do..while loop.</li>
        </ol>
        <h4>Loop Control Statements</h4>
        <p>Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed.

          C supports the following control statements.</p>
        <ol>
          <li><b>break statement:</b>Terminates the loop or switch statement and transfers execution to the statement immediately following the loop or switch.</li>
          <li><b>continue statement:</b>Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.</li>
          <li><b>goto statement:</b>Transfers control to the labeled statement.</li>
        </ol>
      </article>
    </section>
    <section class="main-section" id="functions">
      <header>Functions</header>
      <article>
        <p>A function is a group of statements that together perform a task. Every C program has at least one function, which is main(), and all the most trivial programs can define additional functions.

You can divide up your code into separate functions. How you divide up your code among different functions is up to you, but logically the division is such that each function performs a specific task.</p>
        <p>A function declaration tells the compiler about a function's name, return type, and parameters. A function definition provides the actual body of the function.

The C standard library provides numerous built-in functions that your program can call. For example, strcat() to concatenate two strings, memcpy() to copy one memory location to another location, and many more functions.

          A function can also be referred as a method or a sub-routine or a procedure, etc.</p>
        <h4>Defining a Function</h4>
        <p>The general form of a function definition in C programming language is as follows:</p>
        <pre><code>
return_type function_name( parameter list ) {
   body of the function
}
</code></pre>
        <p>A function definition in C programming consists of a function header and a function body. Here are all the parts of a function:</p>
        <ul>
          <li><b>Return Type-</b>A function may return a value. The return_type is the data type of the value the function returns. Some functions perform the desired operations without returning a value. In this case, the return_type is the keyword void.</li>
          <li><b>Function Name-</b>This is the actual name of the function. The function name and the parameter list together constitute the function signature.</li>
          <li><b>Parameters-</b>A parameter is like a placeholder. When a function is invoked, you pass a value to the parameter. This value is referred to as actual parameter or argument. The parameter list refers to the type, order, and number of the parameters of a function. Parameters are optional; that is, a function may contain no parameters.</li>
          <li><b>Function Body-</b>The function body contains a collection of statements that define what the function does.</li>
        </ul>
        <p>Given below is the source code for a function called max(). This function takes two parameters num1 and num2 and returns the maximum value between the two:</p>
        <pre><code>
/* function returning the max between two numbers */
int max(int num1, int num2) {

   /* local variable declaration */
   int result;
 
   if (num1 > num2)
      result = num1;
   else
      result = num2;
 
   return result; 
}
</code></pre>
        <h4>Function Declarations</h4>
        <p>A function declaration tells the compiler about a function name and how to call the function. The actual body of the function can be defined separately.

          A function declaration has the following parts:</p>
        <pre><code>
return_type function_name( parameter list );
</code></pre>
        <p>For the above defined function max(), the function declaration is as follows:</p>
        <pre><code>int max(int num1, int num2);</code></pre>
        <p>Parameter names are not important in function declaration only their type is required, so the following is also a valid declaration:
        </p>
        <pre><code>
int max(int, int);
</code></pre>
        <p>Function declaration is required when you define a function in one source file and you call that function in another file. In such case, you should declare the function at the top of the file calling the function.</p>
        <h4>Calling a Function</h4>
        <p>While creating a C function, you give a definition of what the function has to do. To use a function, you will have to call that function to perform the defined task.

When a program calls a function, the program control is transferred to the called function. A called function performs a defined task and when its return statement is executed or when its function-ending closing brace is reached, it returns the program control back to the main program.

To call a function, you simply need to pass the required parameters along with the function name, and if the function returns a value, then you can store the returned value.</p>
        <h4>Function Arguments</h4>
        <p>If a function is to use arguments, it must declare variables that accept the values of the arguments. These variables are called the formal parameters of the function.

Formal parameters behave like other local variables inside the function and are created upon entry into the function and destroyed upon exit.

          While calling a function, there are two ways in which arguments can be passed to a function:</p>
        <ol>
          <li><b>Call by value:</b>This method copies the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument.</li>
          <li><b>Call by reference:</b>This method copies the address of an argument into the formal parameter. Inside the function, the address is used to access the actual argument used in the call. This means that changes made to the parameter affect the argument.</li>
        </ol>
        <p>By default, C uses call by value to pass arguments. In general, it means the code within a function cannot alter the arguments used to call the function.</p>
      </article>
    </section>
    <section class="main-section" id="arrays">
      <header>Arrays</header>
      <article>
        <p>Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type.

Instead of declaring individual variables, such as number0, number1, ..., and number99, you declare one array variable such as numbers and use numbers[0], numbers[1], and ..., numbers[99] to represent individual variables. A specific element in an array is accessed by an index.

All arrays consist of contiguous memory locations. The lowest address corresponds to the first element and the highest address to the last element.</p>
        <div id="graph2">
          <img src="https://www.tutorialspoint.com/cprogramming/images/arrays.jpg" alt="array visual rep">
        </div>
        <h4>Declaring Arrays</h4>
        <p>To declare an array in C, a programmer specifies the type of the elements and the number of elements required by an array as follows:</p>
        <pre><code>
type arrayName [ arraySize ];
</code></pre>
        <p>This is called a single-dimensional array. The arraySize must be an integer constant greater than zero and type can be any valid C data type. For example, to declare a 10-element array called balance of type double, use this statement:</p>
        <pre><code>
double balance[10];
</code></pre>
        <p>Here balance is a variable array which is sufficient to hold up to 10 double numbers.</p>
        <h4>Initializing Arrays</h4>
        <p>You can initialize an array in C either one by one or using a single statement as follows:</p>
        <pre><code>
double balance[5] = {1000.0, 2.0, 3.4, 7.0, 50.0};
</code></pre>
        <p>The number of values between braces { } cannot be larger than the number of elements that we declare for the array between square brackets [ ].

If you omit the size of the array, an array just big enough to hold the initialization is created. Therefore, if you write:</p>
        <pre><code>
double balance[] = {1000.0, 2.0, 3.4, 7.0, 50.0};</code></pre>
        <p>You will create exactly the same array as you did in the previous example. Following is an example to assign a single element of the array:
        </p>
        <pre><code>
balance[4] = 50.0;
</code></pre>
        <p>The above statement assigns the 5th element in the array with a value of 50.0. All arrays have 0 as the index of their first element which is also called the base index and the last index of an array will be total size of the array minus 1. Shown below is the pictorial representation of the array we discussed above:</p>
        <div id="graph1">
          <img src="https://www.tutorialspoint.com/cprogramming/images/array_presentation.jpg" alt="array visual rep">
        </div>
        <h4>Accessing Array Elements</h4>
        <p>An element is accessed by indexing the array name. This is done by placing the index of the element within square brackets after the name of the array. For example:</p>
        <pre><code>double salary = balance[9];</code></pre>
        <p>The above statement will take the 10th element from the array and assign the value to salary variable.</p>
        <h4>Arrays in Detail</h4>
        <p>Arrays are important to C and should need a lot more attention. The following important concepts related to array should be clear to a C programmer:</p>
        <ol>
          <li><b>Multi-dimensional arrays:</b>C supports multidimensional arrays. The simplest form of the multidimensional array is the two-dimensional array.</li>
          <li><b>Passing arrays to functions:</b>You can pass to the function a pointer to an array by specifying the array's name without an index.</li>
          <li><b>Return array from a function:</b>C allows a function to return an array.</li>
          <li><b>Pointer to an array:</b>You can generate a pointer to the first element of an array by simply specifying the array name, without any index.</li>
        </ol>
      </article>
    </section>
    <section class="main-section" id="reference">
      <header>Reference</header>
      <article>
        <p>All the information in this technical documentation is taken from <a href="https://www.tutorialspoint.com/cprogramming/index.htm" target="_blank">tutorialspoint</a> website.</p>
      </article>
    </section>
  </main>
 </body>
        
            
        
        
          
          
          
        
      
          
        
     

              
            
!

CSS

              
                body{
  font-family: 'Zilla Slab', serif;
  background-color:rgba(15, 4, 76, 1);
  color:white;
  min-width:290px;
  font-size:62.5%;
}
nav{
  position: fixed;
  left: 0px;
  top: 0px;
  height: 100%;
  width:300px;
  min-width:290px;
  border-right:solid;
  border-color:rgba(108, 122, 137, 1);
  font-size:1.6em;
  
  
  
  
  
}
.navlist{
  
}
header{
  font-weight:bold;
  font-size:1.5em;
  margin-top:1.5vw;
  margin: 10px;
}
h4{
  color:#FAF9F9;
  
  
}
nav > ul > li{
  list-style: none;
  line-height:3.8vw;
  text-align:center;
  position:relative;
  border-top:1px solid;
  width: 100%;
  
  
}
nav > header{
  text-align:center;
  
}
.nav-link{
  text-decoration:none;
  color:white;
  display:block;
  padding: 10px 30px;
  text-decoration: none;
  cursor: pointer;
}
nav > ul {
 height: 88%;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  
 
}
main{
  font-size:1.6em;
  text-align:left;
  line-height:2.3vw;
  margin-left: 310px;
  padding: 20px;
  margin-bottom: 8px;
  margin-right:10px;
  overflow:auto;
}
section article{
  margin:15px;
  
  
}
#graph3{
 text-align:center;
    
}
#graph2{
  text-align:center;
  
}
#graph1{
  text-align:center;
   
}
img{
  max-width: 100%;
  height: auto;
  width: auto;
}

code{
  display:block;
  background-color:rgba(120, 122, 145,1);
  margin-left:3vw;
  margin-right:1vw;
  border-radius:4px;
  padding-left:1vw;
}

@media (max-width: 750px) {
  nav{
    position:absolute;
    top:0px;
    width:100%;
    height:30vw;
    padding:0;
    margin:0;
    border-bottom: 2px solid;
    font-size:1.2em;
  }
  #main-doc{
    
    margin-left:0px;
    margin-top:30vw;
    font-size:1.2em;
    line-height:5vw;
  }
  header{
    font-size:1.3em;
  }
}
              
            
!

JS

              
                // !! IMPORTANT README:

// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place. 

/***********
INSTRUCTIONS:
  - Select the project you would 
    like to complete from the dropdown 
    menu.
  - Click the "RUN TESTS" button to
    run the tests against the blank 
    pen.
  - Click the "TESTS" button to see 
    the individual test cases. 
    (should all be failing at first)
  - Start coding! As you fulfill each
    test case, you will see them go   
    from red to green.
  - As you start to build out your 
    project, when tests are failing, 
    you should get helpful errors 
    along the way!
    ************/

// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!

// Once you have read the above messages, you can delete all comments. 

              
            
!
999px

Console