让我们A成为代表面具的numpy数组.我想提取对应于这个掩码的边界,即除边界外,使一切都为零.
例如:
In [22]: A
array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 1, 1, 1, 1, 1, 1, 0, 0],
[0, 0, 1, …Run Code Online (Sandbox Code Playgroud) #inlude <stdio.h>
typedef struct node
{
int data, height, count;
struct node *left, *right, *father;
}node;
node *root = NULL;
void main(){
//some code here
}
Run Code Online (Sandbox Code Playgroud)
上面的代码没有错误,但是
#inlude <stdio.h>
typedef struct node
{
int data, height, count;
struct node *left, *right, *father;
}node;
node *root;
root = NULL;
void main(){
//some code here
}
Run Code Online (Sandbox Code Playgroud)
这会产生以下错误:
sample.c:11:1: error: conflicting types for 'root'
sample.c: 10:7 note: previous declaration of 'root' was here
node *root;
^
Run Code Online (Sandbox Code Playgroud)
声明时不再复制上述错误
root = NULL;
Run Code Online (Sandbox Code Playgroud)
在...内宣布 main function …