Well once I went through and changed all the int's to long's, the program gave all the correct outputs. The issue was that I neglected to replace the int's used for the counters in the for loops.
...
Type: Posts; User: jwroblewski44
Well once I went through and changed all the int's to long's, the program gave all the correct outputs. The issue was that I neglected to replace the int's used for the counters in the for loops.
...
@nonpuz
I spoke with my department chair(he was a judge during the comp) and he gave me the test cases for the problem. When I have some free time ( thanksgiving break? ), I'm going to check test...
Yes. I agree that writing my own sort was not the best approach. Simply, I don't have much experience using the standard system sorts, but I did have access to a book with a sort method I was...
@grumpy
If you could be more specific as to how I'm failing to do what the program asked.
From the last paragraph of the description:
"Your team is to write a program to assist the director...
Hello, all!
First off, this is program from the ACM programming contest, of which today I and two teammates competed. We managed to solve two of nine correctly, but sadly the two programs I was...
Thank you.
I am working on an intro to OS book and have some questions about this code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/wait.h>
So when I have a string in quotes, there is an implied null byte at the end?
I'm not understanding why the string provided for initialization is too long?
int main()
{
char array[1] = "A";
return 0;
Thank you laserlight. That makes sense. Otherwise the contents of the array would be alterable, right?
I am writing a class Player which has several char arrays as private fields. I am trying to write a method which returns an array as a pointer, but doesn't alter the array in any way, thus the const....
Well I am not sure what UART is, but this is wrong:
*(unsigned int*) AHB_LED_BASE = 0x55; //wrong
...
*(unsigned int*) AHB_LED_BASE = 0xAA; //wrong
The define preprocessor command...
Thanks. More reading on streams is definitely required.
So if I'm understanding correctly, the return value of getline is a boolean value, which is the opposite value of std::basic_ios::fail. And std::basic_ios::fail returns true if eofbit is set, and...
Sorry to rehash old topics, but I couldn't find a relevant post to my question. I have smashed together some code that does what I want, but I'm not quite sure why. The problem I'm trying to solve is...
Address space layout randomization - Wikipedia, the free encyclopedia
I would say that grumpy's original idea would be best.
It's not meant to be robust, just an example. But thanks for pointing that out.
Here is a sample program using a linked list. Note that the most basic of operations have been given their own functions.
linkedlistop.h
// linkedlistop.h
struct node
{
Memory management is key to using C, so it shouldn't be shrugged off. Do research on the tool Valgrind, and use it.
Don't forget; all dynamic memory allocated MUST be free'd by the programmer to...
Could you tell us what algorithm you're using?
Always check the returned pointer from malloc to check for failed allocation.
Also I would modify it so you can search for a particular value, rather than just showing the last element.
Your...
edit: didn't read entire thread
Were you planning on using C or C++?
This seems best suited for C++, but I found a link on stack overflow that might be of use if you demand good ol' C: oop - How can I simulate OO-style...
If you ask me, your solutions simplicity is a good thing. With small programs like this, moving a one liner into a function is simply a matter of preference. But when your code portions start to...
im sorry, you are correct.