假设我定义了以下内容:
unsigned char temp[2][13];什么是默认值将分配给此char[] ? 它就像{'', '', '', ... , ''} ?
在我的程序(计算器)中,我有operand[2][13] (其中第一个操作数是operand[0] ,第二个操作数是operand[1] ),我有操作和Result[15] ,它们都是unsigned char 。 Fisrt,用户将进入Operand1和Operand2(一次一个字符),它将存储在operand[2][13]然后程序将结果存储为Result[15]字符。 现在我想要的是,在下一次迭代中,我想清除operand[2][13] ,操作和Result[15]以便用户可以输入下一个操作数,程序执行下一个操作并将结果保存在Result[15] 。
我该如何清除这些数组?
Suppose I define the following:
unsigned char temp[2][13];What is the default values will be assign to this char[]? Is it like {'', '', '', ... , ''}?
In my program (The calculator), I have operand[2][13] (where first operand is operand[0] and second operand is operand[1]) and I have Operation and Result[15] and they are all unsigned char. Fisrt, the user will enter Operand1 and Operand2 (A char at a time) and it will be stores in operand[2][13] then the program will store the result as chars in Result[15]. Now what I want is, at next iteration, I want to clear operand[2][13], operation and Result[15] so that the user can enter next operands and the program executes next operation and saves the result in Result[15].
How can I clear these arrays?
最满意答案
memset (operand, 0, 2 * 13); memset (Result, 0, 15); memset (Result, 0, 15);
memset(operand, 0, 2 * 13); memset(Result, 0, 15);
更多推荐
发布评论