-
char *str="\ame\\\101ddress\b\xaf";
printf("%d",strlen(str));The output is 15
The explanation is as follows: 1) Escape character, which represents a backslash character''\", which is 1 character.
2) name—4.
3) Same as (1), 1 character.
4) 101—Because of DDD, it means a 1 to 3 octal number, 1 character.
5) ddress — 6 pcs.
6) b—escape character, indicating backspace (bs), move the current position to the previous column, 1 character.
7) xaf—because xhh, which represents any character represented by 1 to 2 digits of hexadecimal, 1 character.
All add up: 1+4+1+1+6+1+1=15.
-
19 counted'\0',, b, etc. are escape characters.
-
Using the coordinate difference and the radius of the triangle, the sum of the squares of the two right-angled sides is equal to the square of the third side (radius squared). This is the criterion for judgment. Outside the circle is greater than the radius squared.
But the key test of this question is the scope of if without increasing the brackets. The last else only matches the previous if, not the first if, but at the same time the two cannot be true at the same time.
So[3] there must be an else, so that the following if....else is under this else.
#include
void main()
-
Question 1: A little around, the landlord looks carefully!
while(++i) means that the loop is executed when the value of the expression "++i" is not 0.
First understand that ++i is the expression "++i" plus 1 and then i and then 1, that is to say, in the first judgment in while, the judgment statement "++i" is equal to -4, then the value of i is also added by 1 to become -4, and then s=0+(-4).
By analogy, when the value of "++i" is 0, s+=i will no longer be executed. Before that, it is not difficult to deduce the value of i to -1. So s is ultimately (-4) +3) +2) +1) = -10;
So why does i end up being 0?
It turns out that the final execution judgment "++i" step still needs to be executed, since it is executed, the value of i must be added to 1, that is, 0, but the statement in the loop is no longer executed. (Here you need to take a good look at the basic execution steps of the while statement, (the last step of the while statement is to judge the statement), very important basic knowledge).
Question 2: The landlord needs to understand the definition statement in C.
#define s(r) pi*r*r
Pi*R*R is used without parentheses, and special attention needs to be paid to use it (I personally feel that this is a defect of the C language).
Go to dinner first, come back and continue to answer, I hope the landlord adopts my answer!
-
0,-10
9********************=++i is the self-increment first and then participate in the operation, and the operation ends when the self-increment reaches 0.
I self-increment 5 times: -4 -3 -2 -1 0 (will not enter the loop at this time).
The corresponding s: -4 -7 -9 -10********************=The macro will only be replaced by a rigid drag, and will not be automatically parameterized.
s(s1+s2) s(r) pi*r*rpi*s1+s2*s1+s2
After a strong turn, it becomes 9
-
23 k++;Because this paragraph is a comparison between the character with the subscript J in S1 and the character with the subscript K in S2, when the next character is equal to the next character, J++ is gone, and K will also be moved to the next position.
24 strcpy(&s1[i],s3);
25 strcat(s1,temp);
26 k==1
-
10 assumes that the machine word length is 8 bits.
Question 1: The binary format of 7 is 0000 0111
The end result is 1
Question 2: The binary format of 10 is 0000 1010
The final result is 0
if(x > 0)
y = 1;
else if(x == 0)
y = 0;
elsey = 01;
or y = (x>0?1:(x==0?0:-1));
The first space: the current of the series circuit is equal everywhere: i 3 r1 = the second space: r2 voltage is: , the power supply voltage: 3 + 2 5v the third space: 4 + 6 10 ohms. >>>More
Question 1: Point (1, 1).
The second question, points (2,-3). >>>More
I'll give you a detailed description of the process and related formula knowledge points. >>>More
1) Process Indicates that the colorless solution is acidic. >>>More
Questions from the National Computer Level 2 Transcription Examination (C language). >>>More