So, I say Bubble Sort, but it's actually one piece of an assignment that encompasses the bubble, shell, and quick sorts. But I feel if I get some advice with one that it'll put me in the right direction to finishing the others as well. Ultimately, my bubble sort generates an array of 20 random numbers, sorts the array, but while it's sorting, it's also supposed to count the costs of comparisons and swaps.
Basically, a compare costs 1 unit, and a swap costs 6 units. I just need some idea of where to start in order to calculate it, because right now, my comparison cost counts all the way up to (most recently) 2060866457.
Okay, so I do have my program fixed basically (after you mentioned line 50), because originally my idea was to sort it, then since my bubble function returned cost, that I'd make it equal to cost in my main function. But as to your original advice of changing line 11, I had already tried that previously and it was always printing out "0" as the cost. It wouldn't do anything but print 0 until I had just initialized the variable by itself without a value.
But I ended up rewriting the program and it seems like it does what it's supposed to now.
In case you were interested in how I ended up fixing it (which you're probably not, but oh well, heh):