arrays - Delete the content of a int * in C -


if have array one:

int * array = ... 

and if want delete it's content, fastest , efficient way in c ?

if "deleting content" mean zeroing out array, using memset should work:

size_t element_count = ... // defines how many elements array has memset(array, 0, sizeof(int) * element_count); 

note having pointer array , no additional information insufficient: need provide number of array elements well, because not possible derive information pointer itself.


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -