foo.cc: In function ‘int kto10(std::string, int)’:
foo.cc:6:22: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
6 | for(int i=0;i<n.size();i++)
| ~^~~~~~~~~
foo.cc:9:32: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
9 | ans=ans*k+n[i]-'0';
| ~~~^~
foo.cc:5:13: note: ‘ans’ was declared here
5 | int ans;
| ^~~
In function ‘int kto10(std::string, int)’,
inlined from ‘int main()’ at foo.cc:23:20:
foo.cc:9:32: warning: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
9 | ans=ans*k+n[i]-'0';
| ~~~^~
foo.cc: In function ‘int main()’:
foo.cc:5:13: note: ‘ans’ was declared here
5 | int ans;
| ^~~