Home > Back-end >  How to change the first 8 bytes
How to change the first 8 bytes

Time:01-21

Binary content

X35 x73 0, 0 x30, 0, 0 x56, 0 x78, 0 xa2, 0 x36, 0 x10, 0 xee, 0 x68, 0 xf2.

The get

X35 0 x10, 0 x30, 0, 0 x56, 0 x78, 0 xa2, 0 x36, 0 x73, 0 xee, 0 x68, 0 xf2.

CodePudding user response:

STD: : swap (a [0], a [7]);

CodePudding user response:

Char b=NULL;
B=a, [7].
A [7]=a, [0].
A [0]=b;

CodePudding user response:

refer to 2 floor not to advance is to go back 1 response:
char b=NULL;
B=a, [7].
A [7]=a, [0].
A [0]=b;
NULL with puzzling

CodePudding user response:

reference lin5161678 reply: 3/f
Quote: refer to the second floor response: not to advance is to go back 1

Char b=NULL;
B=a, [7].
A [7]=a, [0].
A [0]=b;
NULL with puzzling
and should use unsigned types, likely beyond expression

CodePudding user response:

Array access will not exchange?

CodePudding user response:

 # include & lt; Stdio. H> 
The do # define SWAP (a, b) ((& amp; (a)).=(& amp; (b)))? ^ ^=((a) (b)=^=(a) (b)) ((a)=(a)); While (0)
Char * p="1", * p2="2";
Char c1=1, c2=2;
Short s1=1, s2=2;
Int i1=1, i2=2;
__int64 I1=1 i64, I2=2 i64;
Float f1=1.0 f, f2=2.0 f;
Double d1=1.0, d2=2.0;
Void main () {
SWAP ((int) (p1, p2) (int). Printf (" % char * % 5 s, 5 s \ n ", p1, p2);
SWAP (c1, c2); Printf (" char % 5 d, % 5 d \ n ", c1, c2);
SWAP (s1, s2); Printf (" short % 5 d, % 5 d \ n ", s1, s2);
SWAP (i1, i2); Printf (" int % 5 d, % 5 d \ n ", i1, i2);
SWAP (I1, I2); Printf (" __int64 % i64d 5, 5 i64d % \ n ", I1, I2);
SWAP (* (int *) & amp; F1, * (int *) & amp; F2); Printf (" float % 5 g, 5 g \ % n ", f1, f2);
SWAP (* (__int64 *) & amp; D1, * (__int64 *) & amp; D2); Printf (" double % 5 lg, % 5 lg \ n ", d1, d2);

SWAP (c1, c1);
Printf (" % d \ n ", c1);
}
//char * 2, and 1
//char (2, 1
//short 2, 1
//int (2, 1
//__int64 2, 1
//float 2, 1
//double 2, 1
//2

CodePudding user response:

refer to 2 floor not to advance is to go back 1 response:
char b=NULL;
B=a, [7].
A [7]=a, [0].
A [0]=b;

You can directly use the int, define int b;
However, there have been problems with NULL initialization, not initialize it doesn't matter, because the first statement is b=a, [7].

CodePudding user response:

refer to 6th floor 4 teacher zhao response:
 # include & lt; Stdio. H> 
The do # define SWAP (a, b) ((& amp; (a)).=(& amp; (b)))? ^ ^=((a) (b)=^=(a) (b)) ((a)=(a)); While (0)
Char * p="1", * p2="2";
Char c1=1, c2=2;
Short s1=1, s2=2;
Int i1=1, i2=2;
__int64 I1=1 i64, I2=2 i64;
Float f1=1.0 f, f2=2.0 f;
Double d1=1.0, d2=2.0;
Void main () {
SWAP ((int) (p1, p2) (int). Printf (" % char * % 5 s, 5 s \ n ", p1, p2);
SWAP (c1, c2); Printf (" char % 5 d, % 5 d \ n ", c1, c2);
SWAP (s1, s2); Printf (" short % 5 d, % 5 d \ n ", s1, s2);
SWAP (i1, i2); Printf (" int % 5 d, % 5 d \ n ", i1, i2);
SWAP (I1, I2); Printf (" __int64 % i64d 5, 5 i64d % \ n ", I1, I2);
SWAP (* (int *) & amp; F1, * (int *) & amp; F2); Printf (" float % 5 g, 5 g \ % n ", f1, f2);
SWAP (* (__int64 *) & amp; D1, * (__int64 *) & amp; D2); Printf (" double % 5 lg, % 5 lg \ n ", d1, d2);

SWAP (c1, c1);
Printf (" % d \ n ", c1);
}
//char * 2, and 1
//char (2, 1
//short 2, 1
//int (2, 1
//__int64 2, 1
//float 2, 1
//double 2, 1
//2
this is a bad practice
There are a lot of problems
For example,
SWAP ((int) (p1, p2) (int). P1 is not directly be mistakes in grammar expression (int) lvalue cannot & amp;
Can exchange integer can't exchange float

CodePudding user response:

Don't superstitious books, examination questions, teachers, reply;
CPU to superstitions, compiler, debugger, run results,
And please combine "the blind man touched the sun" and "boat out to sea must carry only a compass," try to understand,
Any theory, authority, according to legend, the truth, and the standard, explain, imagination, knowledge... Is not in my eyes!

CodePudding user response:

reference 7 building self-confidence boy reply:
Quote: refer to the second floor response: not to advance is to go back 1

Char b=NULL;
B=a, [7].
A [7]=a, [0].
A [0]=b;

You can directly use the int, define int b;
However, there have been problems with NULL initialization, not initialize it doesn't matter, because the first statement is b=a, [7].

Educated, thanks.

CodePudding user response:

refer to fish out of water, 4/f, reply:
Quote: refer to the third floor lin5161678 response:
Quote: refer to the second floor response: not to advance is to go back 1

Char b=NULL;
B=a, [7].
A [7]=a, [0].
A [0]=b;
NULL with puzzling
and should use unsigned types, likely beyond expression

Good, learn, thanks.
  • Related