charges.cpp:17:4: error: 'std::vector<long long int> link' redeclared as different kind of entity
17 | vn link;
| ^~~~
In file included from /usr/include/c++/13/bits/atomic_wait.h:45,
from /usr/include/c++/13/bits/atomic_base.h:42,
from /usr/include/c++/13/bits/shared_ptr_atomic.h:33,
from /usr/include/c++/13/memory:81,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:56,
from charges.cpp:1:
/usr/include/unistd.h:819:12: note: previous declaration 'int link(const char*, const char*)'
819 | extern int link (const char *__from, const char *__to)
| ^~~~
charges.cpp: In function 'long long int find(long long int)':
charges.cpp:23:24: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | while ( n != link[n])n=link[n];
| ^
charges.cpp:23:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
23 | while ( n != link[n])n=link[n];
| ~~^~~~~~~~~~
charges.cpp:23:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | while ( n != link[n])n=link[n];
| ^
charges.cpp:23:34: error: invalid conversion from 'int (*)(const char*, const char*) noexcept' to 'long long int' [-fpermissive]
23 | while ( n != link[n])n=link[n];
| ~~~~~~^
| |
| int (*)(const char*, const char*) noexcept
charges.cpp: In function 'void unite(long long int, long long int)':
charges.cpp:36:11: warning: pointer to a function used in arithmetic [-Wpointer-arith]
36 | link[y]=x;
| ^
charges.cpp:36:12: error: assignment of read-only location '*(link + ((sizetype)y))'
36 | link[y]=x;
| ~~~~~~~^~
charges.cpp: In function 'int main()':
charges.cpp:48:10: error: request for member 'resize' in 'link', which is of non-class type 'int(const char*, const char*) noexcept'
48 | link.resize(n+1);
| ^~~~~~
charges.cpp:53:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
53 | for (int i=1;i<=n;i++)link[i]=i;
| ^
charges.cpp:53:34: error: assignment of read-only location '*(link + ((sizetype)i))'
53 | for (int i=1;i<=n;i++)link[i]=i;
| ~~~~~~~^~