Hey,

I was wondering if you guys could explain in detail the time-space differences between memset and a for loop. For example, consider the two pieces of code:

Code:
char arr[10];
for (int i = 0; i < 10; i++)
arr[i] = '\0';

Code:
char arr[10];
memset( arr, '\0', sizeof(arr) );
How much faster is the second version versus the first version? I know you save space since you don't need to allocate anything for i or get it's value, but how exactly does memset work? Does it go through the bytes specified and put in a 0, or does it do it more efficiently?

Thanks.