Earlier quoted context omitted.
This whole point of Fizzbuzz is to see how one structures their code. Or at least ascertain that one _can_ write code in the first place.
How much structure can a fizzbuzz have exactly?
A way to torture an interviewer (C++, FizzBuzz)
61–70 of 84 posts
Re: A way to torture an interviewer (C++, FizzBuzz)
#62Earlier quoted context omitted.
No, it's the address past the end of the array {'\0'}.
Mind to unpack that for me? Here's how I unpack this: ""[1] is the 0 (termination) byte. The 0 byte is then interpreted as an address -- the nil address. But what's the use of asking for the address of the null terminator? Where is that stored exactly?
Now the first character of that char array is found here: ""[0]
The second character is found here: ""[1]
So the address of the second character is found here: &""[1]
But as the string was represented by one byte char array that second address is past the end of the string.
So it's actually an undefined address.
Re: A way to torture an interviewer (C++, FizzBuzz)
#63Earlier quoted context omitted.
The evilest way to write `nullptr`.
it is not nullptr, it is address past \0 in "", which is an invalid address
Re: A way to torture an interviewer (C++, FizzBuzz)
#64Earlier quoted context omitted.
No, it's the address past the end of the array {'\0'}.
Mind to unpack that for me? Here's how I unpack this: ""[1] is the 0 (termination) byte. The 0 byte is then interpreted as an address -- the nil address. But what's the use of asking for the address of the null terminator? Where is that stored exactly?
Its address is taken there with &, which yields a const char*. The (char *) cast is only there to cast away const.
Re: A way to torture an interviewer (C++, FizzBuzz)
#65Earlier quoted context omitted.
Mind to unpack that for me? Here's how I unpack this: ""[1] is the 0 (termination) byte. The 0 byte is then interpreted as an address -- the nil address. But what's the use of asking for the address of the null terminator? Where is that stored exactly?
The "" will define a null terminated char array to represent the string. But as it string contains no text it's a char array that only requires one byte (i.e. it contains nothing but the null termination character). Now the first character of that char array is found here: ""[0] The second character is found here: ""[1] So the address of the second character is found here: &""[1] But as the string was represented by…
Re: A way to torture an interviewer (C++, FizzBuzz)
#66 io:println¨ {⍵ (⊂"fizz") (⊂"buzz") (⊂"fizzbuzz") %⍨ 2 (⊥⍤1) ⍉ 0 = 5 3 |⌺ ⍵} ⍳20Re: A way to torture an interviewer (C++, FizzBuzz)
#67You wouldn't torture him. You would just zero the probability of getting an offer. There's no SW house or colleague in his right mind that would want a developer that writes obfuscated and needlessly complex to understand code.
Fizzbuzz is a pass to the next questions. It's a way to weed out random people who have no idea about programming but for some reason came to the interview. While this code wouldn't be an instant offer, it would be a great solution in my eyes and it would follow hardest questions to qualify a candidate for senior position. That's my opinion at least. I'm making a hiring decisions in my company.
Re: A way to torture an interviewer (C++, FizzBuzz)
#68Re: A way to torture an interviewer (C++, FizzBuzz)
#69If a candidate were suggesting this as their serious FizzBuzz implementation fit for production, I'd have a hard talk with them about readability.
What implementation of FizzBuzz do you use in your production environment?
Re: A way to torture an interviewer (C++, FizzBuzz)
#70You wouldn't torture him. You would just zero the probability of getting an offer. There's no SW house or colleague in his right mind that would want a developer that writes obfuscated and needlessly complex to understand code.
Is consider this entertaining rather than torturous. A playful response to the mind numbing idiocy of fizzbuzz.