-
The result is: 1,2,1
if(x++&y++) in x++ is called first and then added, so first judge x=0 is false, because &&& will terminate the judgment as long as one condition is false, so it will not run the following y++, and the value of x, after this statement, is 1,3,2
else if(x+1==6||y--)z--, judge x+1==6, 1+1==6 is false, then judge y—, y is 3 is true, (y is 2 after executing this statement), and then execute z--, so z is 1
-
x=0 so the first if doesn't execute but x++, x=1, y=3, z=2
The next ones are Y-- and Z-
-
If you don't know C, don't talk about C. The Windows operating system you usually use is written in the so-called "junk language" C language! Is C really rubbish?
-
The results may be different in different compilation environments, and the following is executed in the environment:
If the first expression is false, then the subsequent expression will not be judged (in line with common sense, the result of the "and" calculation is true only when the condition is true, and if one of the conditions is false, then the others do not need to be judged), such as.
Over here. if(x++&y++) x is 0 (because the x value is taken to participate in the calculation first, and then the x value is increased by 1), and the condition is not satisfied, the judgment is over, so there is no y++ judgment, then the y value does not change, and of course the z value does not change.
Therefore, after this sentence is executed, the three variable values are: x==1, y==3, z==2
In the same way, the "or" calculation statement in the if condition is also carried out according to the rules of the "or" operation, and it is also calculated from left to right, but when 0 is encountered here, it will not stop judging, but 1.
If the condition is not met, then it will be executed.
else if(x+1==6||y--)z--;
Here, first of all, x+1==6 is judged, obviously 1+1==6 is the result is false, then the value of y--,y is now 3 (after participating in the calculation, then subtract 1, then the result is 2), non-zero value, then the result is true, execute z--,z-value minus 1 (z-result is 1).
The final output is:
-
I don't know what you're asking.
-
Use dev-c++ to open the source.
You can press the F9 key directly to compile + run.
If there is an error in the compilation, correct it in time, otherwise it will not run.
In order to see the output of the screen, we usually return 0 at the end of the program; add a sentence while (1); Trap the program in an endless loop for easy viewing.
Also, the main function in dev must be int.
There's also a picture, you see.
The leftmost is the compile shortcut - ctrl+f9, the middle is run run shortcut - ctrl+f10, and finally the compile & run shortcut - f9 can also be used to press the button directly, and you can also use the shortcut key.
If your icon is different from mine, then put the mouse on it, and the role and shortcut keys will be displayed.
-
Compile first, there is a shortcut key ctrl+f9, and after the compilation prompt is completed, ctrl+f10 runs.
-
Address still garbage? Every address is unambiguous. Only uninitialized address spaces have random garbage!
-
The second problem: p corresponds to a fixed address unit, and the contents of this cell are used as a pointer to access the corresponding memory cell, and the value stored in the latter memory cell is printed. The value stored in the so-called spam address.
In fact, there is nothing garbage in the data, but it is not trash in your program, as long as you use it, it is not rubbish.
-
A is a variable of type int and p is a variable of type int*.
Output a, then it is the int value of a garbage output.
Output *p, then it is to output the value of the memory pointed to by a garbage int * variable, because the right to use the memory pointed to by the garbage int * variable is likely not to belong to you, so this is an "unsafe" behavior, and the compiler will generally report an error.
-
1, it's not an address, or the value in a is a garbage value.
2, Ibid. The value of p is the garbage address, and *p is the garbage value.
-
The value of a is uncertain.
The value of p is uncertain.
p Something that isn't sure about the memory address, maybe a segfault, etc.
-
Since you don't assign a value to the memory represented by a.
So a can point to any memory cell, so it's not garbage, it's a value stored in a memory cell.
It's all 8 bits, of course, it's going to be big, and the one that is different every time can't be called garbage, and there's no syntax error. It's just that a is not initialized and is not assigned. Some compilers default to 0, if not, it is the value in the storage unit a. is an immediate value.
A is a variable of type int and p is a variable of type int*.
Output a, then it is the int value of a garbage output.
Output *p, then it is to output the value of the memory pointed to by a garbage int * variable, because the right to use the memory pointed to by the garbage int * variable is likely not to belong to you, so this is an "unsafe" behavior, and the compiler will generally report an error.
-
Outputs garbage values. If a pointer doesn't have p= null, it will output some garbled values.
-
Typically it should be student assignments, this one doesn't give you the source program directly. Study seriously, but don't take it personally! It's for your good!
-
It's your computer that's faulty or it's software, and I run it without error.
-
As you can see from this path, the generated object file is in a temporary folder (temp), and since it is a temporary folder, of course, it is possible that it cannot be found. It is recommended to use DevCPP for those who have just learned the C language under Windows, because it is simple to operate and easy to use. Of course, the best way to learn C is under Linux, such as Ubuntu.
I now have an ubuntu system in my computer, which I use for learning; One is windos7, which is used for entertainment and learning, and the C C++ compiler installed in windows7 is devcpp.
By the way: when you create a program with devcpp, when you compile it will prompt you to save, and then let you choose the save path, so this is very user-friendly.
-
float max, min;After you define it, you don't initialize it, and the data bits in it are dirty data in memory at that time, and this will happen if the data in min is smaller than the data in your array. Your method of finding the maximum and minimum values is wrong. It's possible that neither the maximum nor the minimum value is the data in your array.
Scope. You static char *chh;
static char *ch1;Although the address pointed to by the two pointers does not change, have you ever wondered whether the memory address they point to has been released, char chc[10]; It's local, the function is out, the lifecycle is over, and you're trying to access it with a pointer in void times(). >>>More
Understand the following rules: 1) Overloading an operator does not change the priority of the operator. >>>More
I've seen questions like this, and I don't understand what you mean, but I think it's like this, structab; I hit ... where you can add definitions of all data forms, e.g., int >>>More
However, it is clear that this is problematic because variable a is not assigned at all. >>>More
Valid variable names for the C language:
First, it can only contain numbers, letters, and underscores. >>>More