for (int x = 0; x < 10; x++)
{
std::cout << arr[x];
}
modi (arr);
for (int x = 0; x < 10; x++)
{
std::cout << arr[x];
}
std::cout << "niggers";
return 0;
}
So I just wrote this. I know what it does, and I know that it works, but I don't know how it works.
int *start dereferences, but the value is undefined, and oh god how the fuck did I make this compile.
Please help.
>>1 I know what it does
I'm pretty sure you don't.
int *start dereferences
No, it doesn't. It declares start as a pointer to integer, with the same value as array itself. If you wanted to dereference anything, you should have written:
int start = *array;
Additionally, the first element of arr is in fact defined as you initialized arr with { 0 }; .
Nigger, I know that I am returning a pointer to an array, I just didn't understand the syntax. Do you honestly think that I could use a piece of code without understanding what it was doing?
Do you honestly think that I could use a piece of code without understanding what it was doing?
Is this a serious question? OF COURSE YOU FUCKING COULD
>>13 Do you honestly think that I could use a piece of code without understanding what it was doing?
Um, this is kindof the point of encapsulation and loose coupling. Better hope you never work on a team of size greater than one...
Name:
Anonymous2009-11-01 13:20
While I do approve of your indentation style(very pleasing to the eyes), I believe you may have too many newlines in your code. By reducing the amount of lines with nothing on them, your code becomes much more readable.
>>20
That's not the point of encapsulation, actually encapsulation is of little importance most of the time.
People write functions and/or methods which combine some operators in such a way that it now performs some more complex functionality and give that functionality a name. That's called abstraction.
You don't want "encapsulation", you want publicly exported APIs which you can use (and hopefully, with proper documentation).