![]() |
viewing contents of array
the object of the class that i made was to get the contents of a target array..this can only handle arrays with numbers so far, but that is not my problem..my problem is that i get the following errors after i compile this program:
G:\Secondary\Dev-Cpp\SOURCES\Chapter 14\vArray.cpp In member function `void vArray::getArray(char*, int)': 13 G:\Secondary\Dev-Cpp\SOURCES\Chapter 14\vArray.cpp `setx' is not a type 13 G:\Secondary\Dev-Cpp\SOURCES\Chapter 14\vArray.cpp request for member of non-aggregate type before '(' token 14 G:\Secondary\Dev-Cpp\SOURCES\Chapter 14\vArray.cpp `getx' is not a type 14 G:\Secondary\Dev-Cpp\SOURCES\Chapter 14\vArray.cpp request for member of non-aggregate type before '(' token i really dont know what any of these mean so can someone please help me? this is the code: :
#include <iostream> |
getx() and setx() are methods that are apart of the class vArray. You are trying to go:
:
arrayName[i].setx(arrayName[i]); |
arrayName[i] will return a char. char is a built in type, it does not have functions called setx, and getx. It looks like you have yourself a bit confused here. What is it you are trying to do.
Edit: Beat to it by King. |
i am trying to make a class that has a main function (getArray), and in getArray, it will return the contents of the target array (getArray(char *arrayName, int arraySZ)). i am a little bit confused as to what to do, but that is why i am here :) i hope that answered your question
|
okay, now i see what i was doing wrong =)
|
You don't really need a whole class just for this, a function would do just fine, take a look at this:
:
#include <iostream>:
#include <iostream> |
wow..much easier :) i thank everyone for the help, this has really aided me
|
| All times are GMT -5. The time now is 12:49 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC