-
This is a problem with queue operations. (Actually, you should give the definition of the queue operation function.) But I'm smart. Hey. You don't have to give. )
Let's start with those functions.
initqueue is the initialization queue.
enqueue is the queue function, the first parameter is the queue, and the second parameter is the queue element.
dequeue is the dequeue function, the first parameter is the queue, and the second parameter is the variable stored in the dequeue element.
Okay, now let's start sentence by sentence.
queue q;
initqueue(q);The queue is initialized, and it should still be an empty queue.
char x=‘e’,y=‘c’;
enqueue(q,‘h');//'h'Enter the queue with a queue of h
enqueue(q,‘r');//'r'Enter the queue and the queue is hr
enqueue(q,y);Y enters the queue and the queue is HRC
dequeue(q,x);Out of the queue, x is h, and the queue is rc
enqueue(q,x);X enters the queue and the queue is RCH
dequeue(q,x);Out of the queue, x is r, and the queue is ch
enqueue(q,‘a');//'a'Enter the queue and the queue is cha
while(!queueempty(q)){ This while loop is the operation of the output queue. The result is a CHA printed on the screen
dequeue(q,y);
printf(y);
printf(x);Output x. The x obtained by the last dequeue operation is'r', so this sentence prints an r on the screen
So.. If you don't understand anything, you can ask me. Hey.
-
Are the letters in the title correct??
-
public class practise elsek++;
k++] parameter a is:"+a+", variable k:"+k);
aa(a - 1);}
public static void main(string args)
Running result: the red marked part is the printing of A in the landlord**; 】
From the rest of the print statements, it is clear why it is the result of 23245.
-
The & in the function argument is the meaning of the alias reference The purpose is to pass the alias of the argument to the parameter, so that the argument can be used to pass the desired value.
For example: voidfun1(int a).
a ++void fun2(int &a)
a++;Now there is the following statement:
int a = 10;
call fun1 --fun1(a); printf("a = %d", a);Result: a = 10;
The reason is that the parameters are released after the function is completed, so a is still equal to 10
call fun2 --fun2(a); printf("a = %d", a);Result: a = 11;
The reason is that since the reference to the argument is passed, the alias, so after the function is completed, the argument is modified so a should be equal to 11
-
A reference is a composite type, defined by an & before a variable, in which case each reference type is associated with some other type. You can't define a reference type of reference, but you can have any other type of reference.
int ival=1024;
int &refval=ival;The fact that operations that act on reval are all on objects that reference bindings.
-
Like a pointer, it is an address.
-
Yan Weimin's book uses the reference of variables as function parameters, using the concept of C++, and if pure C is used, it should be changed to a pointer implementation.
-
As a concept, just remember these and don't need to ask. Because at that time, the symbol was selected when it was defined, just like the @ character, and when you see it, it is associated with e-mail, it just doesn't make sense, you have to enter it when you type email.
-
The dequeue enqueue corresponds to a queue, which is a first-in, first-out linear table.
Push pop corresponds to the stack, which is a first-in, first-out linear table.
-
The difference between a queue (first-in, first-out) and a stack (last-in, first-out).
-
(1) Explicitly passing through the parameters in the parameter table means:
void main()
Calling the pn() function, x is the parameter in the parameter table, and explicitly passing (2) implicitly through a global variable means that now declare a global variable int x before the main function;
void main()
When you call the pn() function, you don't need to pass arguments, but modify the value of the global variable x, implicitly.
In the pn() function, the global variable x is used directly, which is already assigned to x0.
-
Show delivery refers to.
main()Danzhi {.}
x=1;func(x);In the func parameter-slip delay balance table, it is obvious that x is passed as a parameter.
In contrast, implicit passing.
x=1main(){
func();
Here, the global variable x is referenced directly in the func
-
Reference transfer is to pass the argument address to the function, after the function receives the address, it does not allocate temporary memory space on the stack to store the address, but directly connects it as the argument itself, if the argument contains valid data, the function can directly take out (read) through the reference, or assign a value (write) to it. If passing arguments to a function is called forward transfer, then the function returns data that is inversely transferable.
Since the function return value is passed by way of backstacking, and the compiler conventions, it can only be one piece of data (value or object array address) at a time. Many times we will encounter the need for a function to return multiple data, one solution is to build a structure on the heap, use the structure to return multiple data, you can also use reference passing, in addition to returning a data through the function, we can define multiple reference parameters in the function parameters, when the external ** calls, the address of the external multiple variables (real parameters) is passed to the function in the form of a reference (forward passing), and the data is passed to the function, When the function is finished, the result is assigned to the referenced variable and the real argument is overridden (inverse pass).
Just o(n) scans it once, millions of arrays are not big, and c can be opened so big for global variables. >>>More
The creation sequence table is as follows:
by the array element a[0..n-1] to create a sequential table l. Each element in a is placed sequentially in a sequential table, and n is assigned to the length field of the sequential table. The algorithm is: >>>More
I would like to introduce you to Yan Weimin's textbook "Data Structure" (C language version), which is currently a classic textbook with a good reputation in China. >>>More
Use the byval keyword to indicate that the parameter is passed by value, but your first argument is written by byref, which is passed by address, and the second argument is written at nothing, and it is also passed by address by default.
A hash table (also known as a hash table) is a data structure that is directly accessed based on the key value. That is, it accesses records by mapping key values to a location in the table to speed up lookups. This mapping function is called a hash function, and the array that holds the records is called a hash table. >>>More