小编big*_*ben的帖子

C*运算符在数组赋值中的含义

这条线是什么意思?几年后我没有做过C.它是否在parens中执行操作然后使int结果成为指针?

b[0] = *(start + pos++);
Run Code Online (Sandbox Code Playgroud)

c arrays pointers variable-assignment

1
推荐指数
2
解决办法
641
查看次数

移植C代码; 需要按位操作和指针语法的帮助

我有一些C代码,我想移植到java.我没有做太多的C编码,但我能够跟进,直到这个功能.如果有人能帮助我了解正在发生的事情,我将不胜感激.

int reverse_integer(int input) {
    int output = 0, i;

    for ( i=0, i<sizeof(int); i++ ) {
         output = ( input & 0x000000FF ) | output; 
         input >>= 8;
         if ( i < 3 ) {
             output <<= 8;
         }
    }

    return output;
}
Run Code Online (Sandbox Code Playgroud)

该函数用作:

char * position = //some data

/*the included comment on this next line states its the size of a string*/
int i = reverse_integer( *(int*)position ) 
Run Code Online (Sandbox Code Playgroud)

c java porting pointers bit-manipulation

0
推荐指数
2
解决办法
1798
查看次数