Several interview questions

zhaozj2021-02-16  100

I got a new title, just I didn't want to stick it again, so I copied it.

Give everyone a reference, don't cause everyone to pay attention to. Thank you!

Sender: Reaking (Reaking), Letter Area: Office

Title: RE: several interview questions

Sending station: Gulang listening to Tao (Fri Nov 16 17:19:03 2001), transfer

Faint ... still gives a reason.

[Mentioned in the masterpiece of Reicking (Release):]

: There is a little difficulty. I made a reference answer, the reason is not busy.

: [In the masterpiece of Tsky (Sky):]

:: Send a letter: Drinking water (11:53:18, November 16, 2001), transfer

: : 1. INT i = 5, J;

:: J = ( i) * (i -);

:: After running i = ______, j = _________

: I == 5; j == 36;

We know i first calculate i in participating in expression, and I - just the opposite.

Original equivalent (j = ( i) * i) && (i -)

(j == 6 * 6) && (i == 6-1)

: : 2. INT A [] = {0, 1, 2, 3, 4};

:: Int * p [] = {A, A 1, A 2, A 3};

::: Int ** pp = P;

:: Assumption a = 8239150 (can't remember, probably), P = 8239168

:: * (PP ) - a =?

: 2

The third line tells us PP = P;

So PP is equivalent to P ;

And P is equivalent to P 1; equivalent to & p [1];

So * (PP ) is equivalent to * (& P [1]); equivalent to P [1];

P [1]? Equal to A 1;

So the original equivalent price (A 1) -a;

Considering that A and A 1 are plastic addresses, accounting for 2 bytes;

So the answer is 2.

:: 3. INT A [100], I, * P = a;

::: For (i = 0; i <100; i ) a [i] = i;

::: For (i = 0; i <100; i )

:: {

:: * P = a [i];

:: G (& p);

::};

::: For (i = 0; i <100; i )

:: {

:: Printf ("% D", A [i]);

::};

:: Void g (int ** p);

:: {

:: ** p ;

:: * P ;

::}

: 991234567 ... 99

: Ie a [0] == 99; a [i] = i; where 1 <= i <= 99;

priority is higher than *, so * p is equivalent to * (p );

Therefore, the only function of the function VOID G (int ** P) is P from the self-increment (P );

There is no impact on the content points to the argument.

In the cycle of the main () function, when i == 99, * p == a [0] == a [99] == 99; other A [i] has no change.

So the answer is what I said above.

:: 4. The role of the following functions:

::: Fun (char * a, char * b)

:: {

::: While (* a = * b )

:: {};

:: Return;

::}

: String copy function.

This is a simple destiny, you know what is going on less than 2 seconds.

* A is equivalent to * (A ), so the original is equivalent to (* (A )) = (* (b ));

A character copy.

The condition of the cycle is * a == '/ 0', ie * b == '/ 0';

Is the character string copy function is still not obvious?

转载请注明原文地址:https://www.9cbs.com/read-11434.html

New Post(0)