Here is my code:
#include
void scan(int* i)
{
int t=0;
char c;
bool negative=false;
c=getchar_unlocked();
while(c<\'0
getchar_unlocked
is not a C or C++ standard function and therefore it's no surprise that it doesn't work on Windows. It is a POSIX standard I think, but Windows compilers don't support all POSIX functions.
If you replaced getchar_unlocked
with getchar
, it would kind of work, although the algorithm doesn't seem quite right.
You could do this with conditional compilation, like this for instance
#ifdef _WINDOWS
// no getchar_unlocked on Windows so just call getchar
inline int getchar_unlocked() { return getchar(); }
#endif