我无法找到什么<<在java中的意思,因为我无法在Google上搜索它我绝对迷路了!
有问题的代码是:
public int getRGB() {
return ((red << 16) | (green << 8) | blue);
}
Run Code Online (Sandbox Code Playgroud)
取自http://java.sun.com/docs/books/tutorial/essential/concurrency/example/ImmutableRGB.java
非常感谢有人告诉我,谢谢!
抱歉这个愚蠢的头衔.
对于(非常基本的)赋值的一部分,我们使用指针实现堆栈.我在一个小部分遇到了很多麻烦,所以我把它分成了这个小问题.
我将尝试解释我的问题,但阅读代码可能会更容易理解.
有一个结构(名为node),它有2个成员,一个char(命名数据)和一个指向另一个节点(名为next)的指针.
在main函数内部,我有一个名为head的指针指向node1,我想将此指针传递给另一个函数,并使其指向一个新节点(并使这个新节点指向另一个新节点).我认为将指针设置为新节点可能没问题,但我无法正确地将新节点指向另一个新节点.
#include <stdio.h>
struct node {
char data;
struct node *next;
};
void modifyPtr(struct node **p);
int main(void)
{
/* create first 2 nodes */
struct node n1;
n1.data = '1';
struct node n2;
n2.data = '2';
/* set 1st node's next node to the 2nd node */
n1.next = &n2;
/* create a pointer to a node and make it point to the first node */
struct node *head = &n1;
/* this works as …Run Code Online (Sandbox Code Playgroud)