Sunday 15 July 2012

c++ - memset() function outputs undesirably -



c++ - memset() function outputs undesirably -

here screenshot of problem.

the code is

#include <bits/stdc++.h> using namespace std; int a[6][500], b[6][500]; int main() { memset (a, 3, sizeof a); memset (b, -1, sizeof b); cout << a[2][50] << ' ' << b[2][50] << endl; homecoming 0; }

i don't understand why a[2][500] showing 50529027. can tell me what's difference between 2 memset() phone call ?

memset() in byte. a int, a[2][500] on 32 bit machine, value 0x03030303 = 50529027

c++

No comments:

Post a Comment