Hi,
I want to fill up an array of int with 1. I have such problem:
and when i run it:Code:#include <cstring> #include <cstdio> int main() { int y[4]={9,9,9,9}, i; memset(y,1,4 * sizeof(int)); for(i=0;i<4;i++) printf("%d",y[i]); return 0; }
$ ./a.out
16843009168430091684300916843009$
I have no clue what's wrong, I expect something with third argument of memset() but 4 * sizeof(int) is a size of y. Can anyone help me ?
Regards.