can you give me an example for this?
let say the variable is declare in the main func wouldnt it be in stack instead?
thank you for your reply...
User Profile
Collapse
-
if im right does it means...
a) bss stores unitialized global variable and static member
b) data stores the initialized global variable
c) stack is the local variable without static and new/free/malloc//.... command
d) heap is the one with new//malloc...etc command
is that right? so what about text?
Code:#include <string.h> char*str; [B]// bss[/B] int
Leave a comment:
-
-
where do they store??
Code:tmain(intargc, _TCHAR* argv[]){ int*p = new int; *p = 0; cout<< *p << endl;}
my ans for this would be p stored in heap due to the new command and *p will be stored in BSS since it is initialised to zero. but im not sure whether that is right.... -
i'll try to understand the code.u've been a great help! thank you . :DLeave a comment:
-
hi.this is the h.file for the code.
Code:class Word { private: std::string word; public: Sentence *getSentence(); void setSentence(Sentence *sentence); Word(string word); virtual string getKey() { return word;}; virtual ~Word(); virtual string asString(); __declspec( property(get = getSentence, put = setSentence))
Leave a comment:
-
hi.thank you for your reply.
just quick que.. is &vw is where i have the tokenize word in this case?
i was given a constructor Word(string word); i reckon i cant just passed vector<word> into this constructor.so if i do it this way,will the data be passed to the Word object since i didnt declare it in a constructor?...Leave a comment:
-
but how should i indicate the word should be stored in class Word constructor.
will this do .. Word* p where p is the tokenize word and keep updated in a while loop for strtok. thanks for your input.Leave a comment:
-
how to store data in a different class object?
hello..
is there a way of storing data to other class object.
here's the problem.
class Repository is where it reads through the sentences and tokenize it
into words . and what i did is by using strtok i keep all the tokenize words into a vector.and planning to store this vector of word into class Word object.
im not sure whether this is a good idea because it seems hard to store a list of vector into an... -
the string is been passed in iostream& form and the only for me to get access on the string is getline().im not sure whether it is right by using getline() first then convert it into string in order to tokenize it.
any hint would be great! thanks againLeave a comment:
-
thanks for your reply.
so how can i access the copied string into streamstream should i convert it back to string in order to use string method like strtok?...Leave a comment:
-
how to copy iostream& data into string?
hello,
im having problem to copy the data from iostream& into string.and im not sure am i doing the right way by using getline.can anyone give hints how to solve this.
here's to make things clear:
Code://method that reads through the stream and breaks it into words and sentence Document*Repository::addDoc(iostream& inStream,string docId) //test core
-
que on Pointer to a class instance which is stored in a global variable
here's the overview what ive done so far:
Code:class A{}; class B{};public A class C{}:public A //i need to create a function that keep track //of num of active B and C instance //in other file.cpp and file.h std::vector<A*> getsize();
solving this using pointers to a class... -
return type for overload operator []
hi there.i'm having problem to understand the test core.
Code:// m1[ x ] is the matrix'row at xth position Vector v1=m1[x] //return v1 = [0 3 6]
any help would be great
cheers -
-
best method to convert list of string to vector<int>?
what's the best way to convert a list of string to a vector<int>?
what i have now is for loop and iterate each char in the string
Code:string base="[0 3 ; 6 9 ; 12 15 ; 18 21]"; //i have vector<int>row,vector < vector<int>row > mat; //what i want to do with the string is that everytime char != ";" row.pushback(str that convert to int)
-
inheritance or friendship?
hello...
i am looking for a better way of doing Class Matrix.
the current code i have now is Class Vector which is inherited from Class Base.
Class Matrix needs the vector in Class Vector and need some of its private member func like the number of column and protected member that is the vector itself.
the common function between Class Vector and Class Matrix are tostring (convert int to str) and few overload... -
-
thanks for your reply.
im doing this using class.so should i make int x as a private member in order the function for operator[] to get the value x.Leave a comment:
-
overload operators problem
here's the error i have in the test code:
any hints to get the value that it is refering to?...Leave a comment:
No activity results to display
Show More
Leave a comment: