In your construct method add a null terminator to your string (so at the index after the last used space add '\0' then use a ! = '\0' instead of a !=0 ( = 0 might work, but I don't know for sure offhand). So essentially give your counting routine something to end on. It's probably a little bit safer too.

line 55 is also not going to do anything because variable size was passed by value, not by reference, so the value of that variable in main() will be unchanged when the ConstructSet1() returns.

In your construct method add a null terminator to your string (so at the index after the last used space add '\0' then use a ! = '\0' instead of a !=0 ( = 0 might work, but I don't know for sure offhand). So essentially give your counting routine something to end on. It's probably a little bit safer too.

What is wrong is that the function was declared to return an integer, but it does not return anything. If you don't want that function to return an int then change it to a void function void CountElements() , and if you do that then you can not use the function in the cout statement mentioned in the above post.

What is wrong is that the function was declared to return an integer, but it does not return anything. If you don't want that function to return an int then change it to a void function void CountElements() , and if you do that then you can not use the function in the cout statement mentioned in the above post.

For me, the basic premise is lacking. You don't need to count the members of an array because you know how many elements it has when you declare it. Or if it is dynamic, you know how many elements when you ask for them. Why bother counting?

For me, the basic premise is lacking. You don't need to count the members of an array because you know how many elements it has when you declare it. Or if it is dynamic, you know how many elements when you ask for them. Why bother counting?

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...