I don't know how your school's curriculum is focused, but at my school, for one of my classes I had to implement malloc() (a memory allocator) from scratch in C. The students that began with Java really, really struggled on that one. Here is a segment of code from my assignment:
Code: Select all
//If the adjacent block doesn't have enough space, then the one after it might
//By converting the epilogue to a char *, we can treat it like a value and do
//a less-that comparison on the memory addresses
else if (NextBlock(adjacentBlock) > (char *)g_epilogue && IsFree(adjacentBlock))
//if ((NextBlock(adjacentBlock) > (char *)g_epilogue) && IsFree(adjacentBlock))
{
tempSize = SizeOf(ptr) + SizeOf(adjacentBlock);
killBlock(adjacentBlock);
setHeaderFooter(ptr, tempSize, 0); // ALLOCATED);
adjacentBlock = NextBlock(adjacentBlock);
}
//If the epilogue is in front of the adjacent block (IE, it is the last block)
//The heap needs to grow a little
if ((void *)g_epilogue < adjacentBlock)
{
int minimumSize = ((size + 15) & 0xFFFFFFF8) + 8;
int sizeToGrow = minimumSize - SizeOf(ptr);
sizeToGrow += REXPAND;
sizeToGrow &= REXPAND;
Anyway, find a good C tutorial. The basic stuff is really easy to understand. Try to learn pointer arithmetic as soon as you can, and you'll be set, especially for a carreer.
Interestingly, my company has an office in India. I had an interesting discussion with my manager. It would seem that all the tech/programming jobs are going overseas to India. However, he says, programmers in India generally lack low-level and systems programming skills. He said they had a problem finding anyone over there with enough skill to work on their system-level stuff, and couldn't, so the India office does mostly RAD-type stuff like Macromedia Flash, VB, etc.
So long story short, learn C and you'll be a pretty valuable asset in a world that is moving toward slow, easy to program languages.
The best thing to do when your philosophies don't stand up to debate is to lock the thread and claim victory.