.. ::Pop()
{
if (size_ == 0) {std::cerr << "Stack is empty'\n'";}
else {return data_[size_-1];} //size_ is initialized to 0 and incremented when item are pushed to the stack and decremented when they are popped
}
so when stack is empty, and you are calling pop..you are returning data[-1].{crossed array bounds} .Hence you are getting seg fault because of invalid memory access.
~k...
User Profile
Collapse
-
That sort of coding is OK.it depends on the context of coding.
say he might be converting that decimal number to fit in binary logic.Leave a comment:
-
so you have to compare two strings: string in record [s1] and user input string[s2]
Compare the lengths of these two strings;If they are unequal, they dont match.
If they are equal, compare the characters of these two strings one by one till you encounter '\0'.At any point of character comparision of strings, if they are not equal, these strings don't match.
Repeat this procedure for each of the strings in the...Leave a comment:
-
many thanks for the good explanation.
......but it deliberately allows compilers to tune the sizes to make best use of the underlying hardware platform.
What is seen in hardware platform to set the sizes of data types?..like opcode size or memory ..?
And what about java?how come its machine independent?
Regards,
Kishore...Leave a comment:
-
Size of primitive types platform vs language
Hi all,
I am new to programming.I read the following lines:
"Size of primitive types in Java is defined in the language specification, whereas in C and C++ it depends on the platform"
Can somebody explain this clearly?
thanks in advance,
Kishore -
-
How to detect mouse click in C?
Hi,
I am using windows(XP).
In C, we can use scanf statement to accept any character.
I want to accept only mouse click as input.
How can I do in C?
Thanks in Advance,
Kishore -
Sorry for delay--I was with fever.
I am using the following tutorial for profiling:
http://www.netbeans.org/kb/docs/cnd/...?intcmp=925655
kindly, suggest if any better tutorials are there...
Regards,
Kishore...Leave a comment:
-
Hi,
I am a new to assembly language programming.
You said you have 1 year ex in assembly programming;cou ld you tell how learning assembly will help you write efficient c language code?
whats your assembly platform anyways?
Regards,
Kishore -
Efficient program ?
Hi all,
After writing a program, how do you check whether your program is:- CPU efficient
- memory efficient
How can assembly language learning help in writing an efficient program?
Regards,
Kishore -
Yaa ..I think this is a good alternative..
Keep it up!!
Thanks,
Kishore...Leave a comment:
-
-
-
I mean to blink a random number on screen for every 10ms...
Ok?
Thanks,
kishore...Leave a comment:
-
Flash a random number
Hi all,
How to flash a random number in c/c++?
Kindly help...
Regards,
Kishore
No activity results to display
Show More
Leave a comment: