1) You have to declare the type of any variable. Otherwise, the compiler won't know what type of data that variable is storing.
2) Huh? That question makes no sense to me. "void" is used as a type, where no variable is actually being defined - usually, when declaring that a function doesn't return anything. void has nothing to with arrays.
Thanks for the reply guys and really sorry for the weird questions. Let me just post the question given to me and hopefully you guys can get me through this.
Question.
Write a complete C++ program that can read a line of characters (read character by character), and store only the digit characters ‘0’,’1’,…,’9’ inside an array named as "WORD". Place a null character ‘\0’ after last read digit. Then, compute and display the multiply result for all digits that store in the array of WORD. Use a multiply function to do this question.
For example 1, if the program reads the following line, “1Word3Word5”, the program should store in array WORD with the following: ‘1’ ‘3’ ‘5’ ‘\0’ . The sum for all digits of this sentence is 9.
Example Output 1:
Enter a line of characters: 1Word3Word5
The line of characters only contain the number of 1, 3, 5.
Sum for the 1 * 3 * 5 is = 15
For example 2, if the program reads the following line, “hiHi12330”, the program should store in array WORD with the following: ‘1’ ‘2’ ‘3’‘3’ ‘0’ ‘\0’ . The sum for all digits of this sentence is 21.
Example Output 2:
Enter a line of characters: hiHi12990
The line of characters only contain the number of 1, 2, 3, 3, 0.
Sum for the 1 * 2 * 3 * 3 * 0 is = 18
Basically this is the task given to me, I am not asking you guys to solve for me this completely. Just a brief idea or explanation on how I can get this done!