
please wait
|
|
for
loop into your initialize function that prints out the values in the array up to magic[5] say. Does it verify they are zero?col
when the user enters 99 (or any other number for that matter) would the array still be square? Look in the reference to see what the %
operator does.new
. With normal arrays, the size must be known and constant at compile time.for
loop starts at 1, so magicsquare[0][0]
will not have a value set. for
loops should start at 0, because arrays start at 0.
|
|
int arr[3] {};
new
(which requires appropriate use of delete
), do use std::vector
. Dynamic allocation and can be used almost like an array, but has much more useful, convenient, and safe features.
magicmaker.cpp: In function ‘void initialize(int*, int)’: magicmaker.cpp:30: error: expected primary-expression before ‘{’ token magicmaker.cpp:30: error: expected `;' before ‘{’ token |
initialize
function starts on line 17, the error is on line 30?