Hi Guys,
I have an issue thats befuddling me. I am attaching the code below. My problem is in getArrayStruct method, I am not able see the contents of my structure. I think the problem may be a simple mistake but I am not able to pinpoint it. The program compiles and runs okay but the contents of structure returned by getArrayStruct print gibberish, like they have not been initialized. Any pointers/guidance on this is very much appreciated.
Thanks in advance
-sam
Code:structure.h struct structForArray { int size; int position; int mark; int *byteArray; }; And a class that uses it.. thus abcd.h #include "structure.h" class abcd { public : structForArray *source; .... public : abcd(char *filename ) { //call a function to populate the struct populate (filename); ~abcd() {} private: void populate(char *inputfilename); struct structForArray *getArrayStruct(); }; abcd.cpp #include "abcd.h" void abcd::populate(char *inputfilename) { //read from file //populate structure structForArray *inputStream; structForArray inputStr = {0, 0, 0, NULL}; inputStream = & inputStr; ... //for loop ...populating the struct this->source = inputstream; return; } struct structForArray *abcd::getArrayStruct() { //here I am trying to check source structure and return it //but it is empty return this->source; }