English 中文(简体)
C项转让的逻辑价值
原标题:Logical value of an assignment in C
while (curr_data[1] != (unsigned int)NULL &&
    ((curr_ptr = (void*)curr_data[1]) || 1))

两个部分问题。

(curr_ptr = (ave*)curr_data***)在逻辑上评价。 http://www.un.org。

而且,我知道它只是 ha,但while statement legal C? 我不得不通过大的调子来把《守则》其他地方的任务放在一边,因此,如果我能够离开,我真的是 n,但如果它如此奇怪,它使每个人的眼球陷入火焰,我就会改变。

最佳回答

回答你的问题:

  1. It will evaluate to true if curr_ptr isn t set to NULL (i.e. curr_data[1] isn t 0).
  2. I believe it s legal, but there are bigger problems with this line of code.

不管怎么说,我假定你没有写这本法典,因为你在把它删除时重新辩论。 因此,我希望你发现,谁写了这条法典,并将其引入一个 heavy强的物体。

  1. (unsigned int)NULL is ridiculous. Why would you do this? This will probably be the same as just writing 0 (not sure if that s guaranteed by the standard).
  2. What kind of data is in curr_data[1] if it s being cast to a pointer (and pointers are being cast to it)? If it s supposed to be holding a pointer as an integral type, you should use the type intptr_t or uintptr_t provided in <stdint.h> for that purpose (if you re compiler doesn t support C99 ptrdiff_t may be an acceptable substitute).
  3. The || 1 at the end seems to be redundant. If curr_ptr = (void*)curr_data[1] would have evaluated to false, we would have caught that in the first condition.

这可能是痛苦的,但认真重新审议这一行文。 它喜欢加入国际奥委会。

问题回答

(curr_ptr = (ave*)curr_data? >将评价西非法郎,除非它是一个无效点。

假设<代码>curr_data是一系列点数,而你想要的是操作该方位,而其中第二位点位数并不完全无效,同时将其价值分配给<代码>curr_ptr<>/code>,我将:

while ((curr_ptr = (void*)curr_data[1]) != NULL) { ... }

任务在C中是表述,因此你的工作就是如此。 更改<代码>;至{>>>> 系指同一事项,而且更为清楚,至少是这样改动。 如果你有更明确的选择(通常是真实的),那么在条件上的任务就应当避免,但如果这种选择是最为明确的,那么就应当加以利用。

转让的结果是被转让的物体:a = 价值将进行转让,然后评价为a。 如<代码>a = b = 0。

为了进一步清理该法典,无需作废,如果是果园,则使用(无效),而不是使用NUL(只使用点人)。

您不必通过完全相当于“智商”的“智商”。

while (curr_data[1]) {
    curr_ptr = (void *)curr_data[1];




相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签