What is the simplest way to reset array values to 0?

Assume we have a pointer(e.g., defined as int* p) to the beginning of an array and the size of the array(e.g., 1000). We want to reset all 1000 array values to 0. What is the simplest way?

Answers


The simplest way would be to use memset.

memset(p, 0, 1000 * sizeof(int));

Need Your Help

Is there a Python editor with python built in?

python editor

I need an editor with python built into it. Currently I use blender so I do not have install python. Blender comes with the python32.dll to use python. is there another editor out there that I can

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.