Hello, I have an array. I have initialized it in this way: volatile int memory[2][3] = {{0,0,0},{0,0,0}}; I need to clean, reset that array and I'd like to know if it exists an unique operation. I know how I can clean it with two for. Thanks.
What's wrong with memset()?
Are you in the same class as Asad Raza? http://www.keil.com/forum/docs/thread6682.asp
I think my case would be a bit different. I won't a null array, just want zeros in all the terms of my multidimensional array.
ulong ulJunk[10][20]; memset(&ulJunk, 0, sizeof(ulJunk));
Thanks a lot my problem is solved but when the program is compiling there is a warning like that: GPT1.C(346): warning C140: 'memset' undefined; assuming 'extern int memset()' *** WARNING L20: DATA TYPES DIFFERENT SYMBOL: memset MODULE: GPT1.obj (GPT1) DEFINED: C:\KEIL\C166\LIB\C167M.LIB (MEMSET) What can I do?
You need to look up memset in the users guide. http://www.keil.com/support/man/docs/c166/c166_memset.htm The first line of their example shows
#include <string.h>
"What can I do?"
"What can I do?" the same as you do when you use any other Library function; in fact, any other externally-defined function - you need the prototype! This is bog-standard textbook 'C' stuff - noting specific to Keil.