In Portland,Oregon, Jon Van Oast and Megan Kelley invited twelve friends to a Soup Swap.
VOA: special.2010.11.22
swap If main wants to give access to swap to x and Y, it just has to tell swap where x and y are.
如果main函数想要对x和y使用,只要告诉swap,x和y在哪里。
I've decided that I need to be able, in my program, to swap the value of two variables. All right.
我觉定在我的程序中,我可以,交换两个变量值,好的。
The two heads of states are also expected to discuss Egypt's efforts to mediate a prisoner swap between Israel and Hamas.
VOA: standard.2009.09.13
I look at the rest of the list to decide what's the element to swap into the next place.
我会查看列表剩下的部分,来看看需要交换哪个元素。
Mr.Netanyahu said he will fly on Tuesday to Egypt, which has been mediating between Israel and Hamas on the prisoner swap.
VOA: standard.2009.12.27
And I'm going to hook you up to my machines and swap your minds.
我准备把你们绑在机器上,交换意识。
Earlier this year,those two countries tried to negotiate a nuclear fuel swap deal with Iran.
VOA: standard.2010.07.28
In the second case, I found in the next smallest element and moved here, taking what was there and moving it on, in this case I would swap the 4 and the 8, and in next case I wouldn't have to do anything.
在第二次遍历中,我找到了,第二小的元素,把它移到这里,把这里原来的元素移到哪里,在这一次遍历中,我会把8和4交换,然后一次遍历,不会做任何事情。
Clinton said the international community recognizes that Tehran only chose to accept the fuel swap deal because it is facing imminent action in the U.N.Security Council.
VOA: standard.2010.05.25
So, a couple of weeks ago we proposed to swap two integers, and we couldn't at the time.
那么,几周前,我们提出交换两个整数,然而在那时,我们办不到。
On Monday,Iran formally notified the IAEA of its response to the nuclear-fuel swap deal, under which it would ship some low-enriched uranium to Turkey in return for higher grade fuel for a Tehran research reactor.
VOA: standard.2010.05.25
You actually need to kind of do this and then you can swap these two numbers but it requires 50 percent more memory.
你实际上需要这样做,然后才能交换两个数字,但是它需要多50%的内存。
They only need to have values if you care GetInt about getting something back from them, get int, swap you care about its value; but swap, I don't want to hear it again.
它们只需要拥有值,如果你关心,它们的返回值,你关心它的返回值,但是,我不想再得到它的返回。
swap I'm going to keep track of a little variable called swap, it's initially true, and as long as it's true, I'm going to keep going, but inside of the loop I'm going to set it to false, and only if I do a swap will I set it to true.
我打算跟踪一个小的变量称为,初始值为真,只要它是真的,算法就会继续,但是在循环里,我打算把他设为假,除非交换发生,就把它设为真。
Now finally swap has the ability, the power, to modify memory that isn't his own, that's not in his own scope because we've passed it in by address.
最终swap有能力,来修改不属于它的内存,不在它的作用域中,因为我们是通过地址传递的。
And if it sees S-W-A-P, open parentheses, close parentheses, and it hopefully sees two ints inside of it, that's all it needs to do in order to finish compiling your code.
如果它看到了SWAP,左圆括号,右圆括号,它可能载里面看到两个int数,那是它所需要做的,用来完成代码的编译。
Now if you call a function, swap like increment or cube or swap, or in this case, foo, those variables are the parameters to that function, end up getting stored next in memory.
现在如果你调用一个函数,像increment或者cube或者,或者在这个例子里,foo,这些变量都是,函数的参数,在内存中存储。
Well, simply with the * notation at least on the way in when you declare the function called swap, you simply say this is not going to take an int and another int because that's useless.
好的,简单说,当你声明一个函数调用swap函数时,使用*符号,你可以简单说,这不能使用一个int数和另外一个int数,因为那是无效的。
We began here so at this point in the story the next thing that's going to happen is this line called Print F that says swap exclamation point, right?
我们从这里开始,在这里,下一步将要发生了的事情是,这行叫做printf的代码,打印:“交换完成!“对不?
I have to change the prototype of this function to say that swap no longer takes an int per se or another int per se, but rather it takes two pointers, two ints, and in fact, it's on the very last page if you're still flipping.
我改变了这个函数的原型,来说明swap不再携带那两个int数本身,而是携带两个指针,两个整型数指针,实际上,它是在最后那页上。
I get to the end of the loop, and I actually do a little bit of wasted motion there. And the little bit of wasted motion is, I take the value at i, store it away temporarily, take the value where min index is pointing to, put it back in there, and then swap it around.
我走到了循环的末尾,事实上我做了多余的动作了,有点多余的是我把i的值,临时保存起来了,看看MinIndex指向的值,放回到哪里,然后再交换。
So pictorially, it's as though there's now some other part of the blackboard here, maybe way up here where I can put anything I want that's accessible to main, that's accessible to swap, that's accessible to increment or any other function I might implement because it is, in fact, global.
绘画般地,它是在这里黑板上的其他部分,可能在这里的上面,我在哪里可以放置这些东西,使它们可以被main函数使用,可以被swap函数使用,可以被increment函数使用,或者我所实现的其它函数,因为它实际上是一个全局变量。
So this is version two of the swap function and, in fact, it is almost identical, this is before, this is after, before, after and it looks like the solution to this problem that we've been revisiting a couple of times now is just to do what?
这个swap函数的第二个版本,实际上,这几乎是一样的,这是之前的,这个之后的,之前的,之后的,这看起来像是这个问题的解决方案,我们一直多次访问它,目的是什么呢?
Indeed, swap in your printout there is just defined as now taking *a and *b and then it also uses the * later, but we'll come back to what the different uses of the * means, but for now I claim conceptually it just means swap has access to the locations of its parameters.
的确,在打印资料中的swap被定义为,携带*a和*b,之后它也是带*号的,但是我们将说明*的不同用法,现在,我断言swap可以,使用参数的地址。
I'm reminded of the confirmation screen here and that's not too bad, then we put in the card and we click confirm and then finally we see the swap Then finally literally nine steps later the ticket comes out of the machine and then, frankly, had to go through the process of where to put the ticket in the machines.
这里出现了确认画面,那还不是太坏,然后我们把卡插进去,点击确认,然后我们看到了那个,函数。,swap,function。,【笑声】然后最终经过9个步骤,票从机器中出来了,然后,需要找出从哪里,把票放到机器中去。
应用推荐