Main.cc: In function ‘void f(int)’: Main.cc:5:18: warning: ‘memset’ used with constant zero length parameter; this could be due to transposed parameters [-Wmemset-transposed-args] memset(a,a+cnt,0); ^ Main.cc:5:12: error: invalid conversion from ‘int*’ to ‘int’ [-fpermissive] memset(a,a+cnt,0); ~^~~~ In file included from /usr/include/features.h:424:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:533, from /usr/include/c++/7/cassert:43, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33, from Main.cc:1: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:59:1: note: initializing argument 2 of ‘void* memset(void*, int, size_t)’ __NTH (memset (void *__dest, int __ch, size_t __len)) ^