Hi. I´m new both in the forum and in the C++ world. I have some experience in Basic, can read and modify different kinds of scripts (like HTML, Javascript, Lingo, etc) and have had some basic experience with assembler. My main goal right now is to learn C++ to be able, sometime in the future, to make audio software (using the Steinberg VST SDK). Previously I´ve used a program named Synthmaker to produce such programs and consider myself very proficient with it, but due to the limitiations of those kind of enviroments I decided to have a go at C++.
So, having introduced myself, I hope you can help me with this problem I´ve encountered. I´ve been reading the book "C++ for Dummies" as a quick introduction to C++. I tried to make a little program just to test Arrays. This is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
//
// Template - provides a template to be used as the starting
// point
//
// the following include files define the majority of
// functions that any given program will need
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
// your C++ code starts here
void displayArray (int nValues[], int numberOfValues);
int main(int nNumberofArgs, char* pszArgs[])
{
int nArray[20] = {0};
int im1;
for (int i=0; i<20; i++)
{
im1 = i-1;
if (im1 < 0)
{
im1 = 19;
}
nArray [i] = 1;
nArray [im1] = 0;
displayArray [nArray, 20];
}
cout << "\nListo" << endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}
void displayArray (int nValues[], int numberOfValues)
{
for (int l=0; l < numberOfValues; l++)
{
cout << nValues[l];
}
cout << endl;
}
|
When I try to build it, I get the following error:
D:\Tzarls\Cpp\Test - Array.cpp||In function `int main(int, char**)':|
D:\Tzarls\Cpp\Test - Array.cpp|32|error: pointer to a function used in arithmetic|
||=== Build finished: 1 errors, 0 warnings ===|
I have gone through the code several times but can´t find a reason for such error. I´m using code::blocks 8.02, Windows XP SP3 on an Asus Netbook.
ps: I know system() should be avoided, but as a quick solution for tests it works great.