Q:

C++ Bubble Sort (Ascending) function not returning results

I'm trying to use a bubble sort in a function instead of inline, and I seem to be having an issue with it returning results. As in currently, it's giving me no results at all. Here is my code that I have written up so far...
Basically, the user tells the program how many numbers they want to enter (up to 20 allowed) then it inputs those into an array in the order entered. Then it prints the values entered, sorts, and prints the sorted values. Or at least that's what is supposed to happen.
Thanks for the help in advance!
#include <iostream>

using namespace std;

int vault[20] = {};         // array to store the 20 values
int val = 0;                // variable to pass values to the array
int amt = 0;                // variable to get the amount of numbers the user is going to enter
int i = 0;                  // loop counter

// Bubble Sort Function Prototype
void bubble (int (&vault)[20], int val);

// Bubble Sort Function
void bubble (int (&vault)[20], int val)
{
int swap = 1;       // flag used to indicate swaps occuring
int temp = 0;       // holder variable
int x = 0;          // loop counter
int y = 0;          // second loop counter

for (x = 0; (x < val) && (swap = 1); x++)
{
    swap = 0;

    for (y = x+1; y < val; y++)
    {
        if (vault[x] > vault[y])
        {
            temp = vault[x];
            vault[x] = vault[y];
            vault[y] = temp;
            swap = 1;
        }
    }
}
return;
 }

 int main()
 {
cout << "Welcome to the Bubble Sort exe\n\n" << endl;
cout << "Please enter in the amount of numbers you would like to enter: ";
cin >> amt;

cout << "Please enter the values you wish to enter: ";
for(i = 0; i < amt; i++)
{
    cin >> vault[i];
}

cout << "The values you entered in order are: ";
for (i = 0; i < amt; i++)
{
    cout << vault[i] << ' ';
}

cout << "\n\nLet me just sort that for you!" << endl;

bubble(vault, val);

cout << "\n\nHere are the values in ascending order:\n" << endl;
for (i = 0; i < val; i++)
{
    cout << vault[i] << ' ';
}

system("pause");

return 0;
 }

A:

Mathias pointed me in the correct direction. I had forgotten to initialize the variable 'val'. When I corrected that, it works perfectly.
As for everybody saying that this is not a classic bubble sort, I have seen this exact form on multiple sites and on slides from my prof., what is wrong with this way of writing it?
I'm trying this now instead, and it's completely failing on me (sigh):
void bubble (int (&vault)[20], int val)
 {
    bool swap = true;       // flag used to indicate swaps occuring
    int temp = 0;           // holder variable
    int x = 0;              // loop counter
    int y = 0;              // second loop counter

    while (swap = true)
        {
        swap = false;
        x++;
        for (y = 0; y < val - x; y++)
        {
            if (vault[y] > vault[y+1])
            {
                 temp = vault[y];
                 vault[y] = vault[y+1];
                 vault[y+1] = temp;
                 swap = true;
            }
         }
     }
 }

