Posts
 
Reputation
Joined
Last Seen
Ranked #120
Strength to Increase Rep
+10
Strength to Decrease Rep
-2
96% Quality Score
Upvotes Received
253
Posts with Upvotes
194
Upvoting Members
128
Downvotes Received
12
Posts with Downvotes
12
Downvoting Members
5
48 Commented Posts
22 Endorsements
Ranked #64
Ranked #132
~299.96K People Reached
Favorite Tags
c++ x 176
c x 162
java x 65
ruby x 20

389 Posted Topics

Member Avatar for deceptikon

If the user enters a number too large to fit into a long, LONG_MAX will be returned. If the user enters a number that's exactly LONG_MAX, LONG_MAX will also be returned. The first would be an error case, the second would not (in the case that `sizeof(int) == sizeof(long)` - …

Member Avatar for Salem
8
2K
Member Avatar for Iceman10284
Member Avatar for UNIQUE_PRINCE
-1
4K
Member Avatar for nitin1

> Even if you make abc global, it still doesn't work in Visual Studio 2015 Because your function is returning a *copy* of abc and that copy is a temporary object that goes out of scope at the sequence point, just as deceptikon explained. > returnValue seems to point to …

Member Avatar for AssertNull
0
3K
Member Avatar for michael_61

This has (hopefully) been answered here: http://www.dreamincode.net/forums/topic/398067-first-and-the-follow-compilers/

Member Avatar for sepp2k
0
157
Member Avatar for PCSAWICK829

What you posted does not look like source code, it looks like what you might see when you open a binary file in a text editor. Presumably you downloaded the zcode file (which is a bytecode format), not the source code. I do not think the source code of Zork …

Member Avatar for Conrad_2
0
9K
Member Avatar for Altjen_1

Note that using a different extension won't prevent people from opening the file in a text editor. It'll just stop a text editor from being the default application that will open when you double click on it in your file manager (unless the user then selects a text editor as …

Member Avatar for tinstaafl
0
1K
Member Avatar for chubbyy.putto

> <for loop> ::= for ( <expression> ; <expression>; <expression> ) <statement> All three expressions in a for-statement are optional and from C99 onwards the first one may be a variable definition instead. Also note that the assignment specifically says that `<statement>` does not include composite statements (for whatever reason), …

Member Avatar for sepp2k
0
690
Member Avatar for sciprog22

Using your first definition `account1.compareTo(account2)` will call `account2.name.compareTo(account1.name)` and using your second definition it will call `account1.name.compareTo(account2.name)`. So using the result of the comparisson will be the other way around and thus the sort order is reversed.

Member Avatar for sciprog22
0
166
Member Avatar for abdullah_8

This isn't what's causing your syntax error, but Java doesn't have a type named `sum` nor do you define one anywhere in your prorgram (unless you defined it in a different file that you didn't show), so `sum c` is a type error (both on line 7 and line 8). …

Member Avatar for abdullah_8
0
157
Member Avatar for Cory_1

The `>` operator is only defined for primitive types. To compare `Comparable` objects, use the `compateTo` method instead.

Member Avatar for JamesCherrill
0
6K
Member Avatar for MrXortex

It looks like the Ribbit class does not have a `userid=` method - presumably because you did not define one and the corresponding table does not have a `userid` column either.

Member Avatar for Taywin
0
631
Member Avatar for Siberian

Any implementation will definitely *read* everything (well some languages have some kind of "stop here" token, which causes the impelementation to stop reading at that token, but in those case the stuff after would simply not be considered part of the program at all). Even if it did decide to …

Member Avatar for Rashakil Fol
0
347
Member Avatar for Mahnoor_1

There's only a difference when you use the return value of the increment for something. So the two loops are completely equivalent.

Member Avatar for Mahnoor_1
0
282
Member Avatar for laguardian
Member Avatar for stultuske
0
213
Member Avatar for ravi_14

2147483647 is the largest number that an int can store. When you convert it to float, it becomes 2147483648.0 due to floating point accuracies. When you convert that back to int, you'd get 2147483648, except that that's too large to fit into an int. So instead you get an overflow, …

Member Avatar for sandeepjkl
0
210
Member Avatar for hadisur_rahman

> In the program Why you used 0 in return 0 ; The return value of main is the program's exit code. If it is 0, that means that the program terminated successfully. A different return value means that the program failed. This distinction matters most in shell scripts: if …

Member Avatar for sepp2k
0
281
Member Avatar for Ahmed_62

Your question seems to be missing some words. Did you mean "After returning true, does the for loop continue?" If so, the answer is no. When the return statement is reached, the control flow returns to the call site.

Member Avatar for stultuske
0
158
Member Avatar for new_developer

When you don't specify the size of an array, the size is inferred from the initializer. So when you write `int arr[] = {1,2,3}`, that's the same as `int arr[3] = {1,2,3}`. Likewise `char formula[] = {'\0'}` is the same as `char formula[1] = {'\0'}` and equivalently `char fomula[] = …

Member Avatar for Mayukh_1
0
230
Member Avatar for Ihteshamullhaq

It'd have helped us if you had described in what way the code did not behave as expected, but your problem is that you access the matrix out of bounds (the matrix can hold 2x2 items, but you're trying to store 3x3). Also you're printing "1th" and "2th" when the …

Member Avatar for basit_3
0
128
Member Avatar for niski

Syntax errors come with a line and column number as well as some indiciation of what's missing (or what's there that shouldn't be). So to find a syntax error you should look around the given line and column for anything that might fit the error message. If the message is …

Member Avatar for niski
0
227
Member Avatar for nitin1

> I am not to properly understand why, and when we have to dynamic cast. Strictly speaking, you don't ever have to use `dynamic_cast`. You *can* use `dynamic_cast` when the castee is a pointer or reference to a class that contains at least one virtual member (that's what's meant by …

Member Avatar for mike_2000_17
0
5K
Member Avatar for nitin1

If a file has never been added, it is untracked. Untracked files are not affected by anything you do with git (like switching branches). One way of looking at it is that, until you added the file, the file did not exist in any branch. Instead it existed in the …

Member Avatar for sepp2k
0
206
Member Avatar for Baalla

NP means a NTM can solve it in polynomial time (or equivelantly that a DTM can verify the result in polynomial time). Note that NP is a superset (possibly, but not necessarily, a proper superset) of P, meaning that everything in P is also in NP. A problem X being …

Member Avatar for Schol-R-LEA
0
244
Member Avatar for Aeonix

> no instance of overloaded function "System::Console::WriteLine" matches the argument list argument types are: (const std::string) I've never used C++/CLI, but it looks like `std::string` is a distinct type from `System::String` and presumably `Console::WriteLine` only works with the latter as it is a .net method and `std::string` is a C++ …

Member Avatar for Aeonix
0
23K
Member Avatar for XodoX

Whether you can parse each line individually depends on the language. I'd say in most languages, you'd need to parse the program as a whole. But yes, a simple (as in: non-JITing) interpreter generally consists of two phases: parsing and execution. > I suppose the code needs instructions on how …

Member Avatar for sepp2k
0
119
Member Avatar for Sarkurd

If you know how many elements you're going to add to the vector (or you at least have a reasonable upper bound), you can also use `reserve` to reserve the proper amount of memory up front, preventing reallocations. Then you'd have exactly one move constructor call per `push_back` and no …

Member Avatar for Sarkurd
0
283
Member Avatar for davidbr

The `controller` variable is not defined within the `counter` method. You need to either pass it as a parameter or make it a member of the object (by doing `self.controller = controller` in the constructor) and then access it as `self.controller` instead. In the future please include any error messages …

Member Avatar for sepp2k
0
221
Member Avatar for hadisur_rahman

> Is {(1,1), (2,2), (3,3)} symmetric? transitive? Yes! Yes! Obviously I'm not your grader, but I'd expect that you need to give some explanation along with your answers to get a full score. Other than that you are correct. > Why is R = {(1,2), (2,3), (1,3), (2,1)} not transitive? …

Member Avatar for sepp2k
0
157
Member Avatar for CattleOfRa

`gcc` produces a binary executable, not a shell script. To run it, type `./main.out`.

Member Avatar for sepp2k
0
194
Member Avatar for Clearner123

No a char value can not be larger than what fits inside a char. However what getchar returns does not have to be a char value. It could also be EOF. Except for the missing `&`, your `scanf` line is perfectly fine. When `scanf` reaches the end of file (or …

Member Avatar for Clearner123
0
133
Member Avatar for zxz

You need to `#include <stdio.h>` to get the declaration of `fopen`. As it is now you're implicitly declaring `fopen` in a way that is incompatible with its definition. You should be getting a warning about that (and in C99 and later you should instead be getting an error that you're …

Member Avatar for zxz
0
3K
Member Avatar for overwraith

> Something else to consider, using the String.IndexOfAny method will shorten your code considerably And, perhaps more importantly, improve the runtime from being quadratic in the worst case to being linear (in the length of the string).

Member Avatar for sepp2k
2
239
Member Avatar for overwraith

You're right, that when you do `something = new Something();` that basically assigns a "very safe pointer" (a.k.a. reference) to `something`. In fact when you do `something = anything;`, you're assigning a reference. Also note that `x += y` is just a shortcut for `x = x + y;`. So …

Member Avatar for overwraith
0
312
Member Avatar for Vahid_1

How long are the strings you enter? If the first string has more than 2 characters, your first call to `gets` overflows your array. Likewise your second call to `gets` overflows if the second string entered is `2 * sl` characters long or longer. Either way the call to `strcat` …

Member Avatar for sepp2k
0
219
Member Avatar for overwraith

> You're right and that 'variable' is the number of elements. That variable is whatever you say it is. In the context of computer science it's usually the size of the input, but it could be anything as long as you make that clear. For example it's very common to …

Member Avatar for sepp2k
0
240
Member Avatar for lewashby

> When I try to compile this program in gcc I get this error As the error message says, you need to supply the mentioned language options to make the code compile. Alternatively, if you want to make your code compile in C89 mode, you need to replace `char *p …

Member Avatar for TalhaMoazSarwar
0
212
Member Avatar for Niloofar24

Are you sure that that's the definition of `check` that's in scope when you call it? Do you perhaps have any other definitions of `check` in your program, perhaps even one that takes two arguments? In any case, it would help if you gave us a reproducible code sample of …

Member Avatar for Niloofar24
0
310
Member Avatar for khaled_jawaher

You can't, you need a separate field (usually of an enum type) to keep track of which field of the union is set.

Member Avatar for sepp2k
0
150
Member Avatar for prem2

> javac command not found in linux fedora Have you installed the JDK? > vi .bash_profile > export JAVA_HOME=/usr/bin/java JAVA_HOME should be a directory, not an executable, and you shouldn't have to set it yourself. > export PATH=$PATH:/usr/bin/java Again PATH should contain directories, not executables, and /usr/bin is already in …

Member Avatar for sepp2k
0
2K
Member Avatar for it@61@sec
Member Avatar for it@61@sec
0
314
Member Avatar for muhammad_74

Learning Java on Arch Linux is no different than learning Java on any other system. You don't need an emulator - both the Oralce JDK and OpenJDK are available for Linux natively, as are all commonly used Java IDEs (eclipse, netbeans, IntelliJ). So your steps for learning Java would be: …

Member Avatar for muhammad_74
0
460
Member Avatar for priyanka_10

> If static modifier is not applied before does it makes it an instance method ? Yes.

Member Avatar for newcoder310
0
166
Member Avatar for CodeWarrior14

You check the file size after you've already opened the file for writing. Since opening a file for writing creates an empty file with that name (overriding the existing file if it exists), this means that a) the file will always exist and b) it's size will always be 0. …

Member Avatar for sepp2k
0
5K
Member Avatar for Marz_1

Your joueur array holds only one element, but your index goes up to `1` (which would be the second element), which is out of bounds.

Member Avatar for Marz_1
0
207
Member Avatar for Brandon_7

To tell you where you went wrong, it'd be good to know how you got to ten. For each iteration of the outer while loop what's the value of `i` going in, what's the value of `j` after the inner while loop and what's the value of `i` after incrementing …

Member Avatar for rubberman
0
202
Member Avatar for Syeda_2

> i can`t understand this code.... It stores the number `1` in the variable `dx` if the number stored in the variable `a1` is greater than that in the variable `c1` and the value stored in `b1` is larger than that in `a1`.

Member Avatar for gusano79
-1
1K
Member Avatar for Slavi

Did you create the text file on Windows? If so, it probably uses `'\r\n'` as the line ending, so after stripping the `'\n'`, the passwords will end up as `'password\r'` and thus not compare equal to `'password'`. That would explain why the problem does not occur in Windows as Python …

Member Avatar for Ene Uran
0
264
Member Avatar for nitin1

The third is almost certainly the fastest (and the second the second fastest) as it only iterates over a third of the array (and the second over half). However this also means that the third and second functions don't do what you intend. If they did, there would unlikely to …

Member Avatar for Duoas
0
211
Member Avatar for yaya1234

As NathanOliver said, "t6" isn't a char, it's a char array. To get 't' and '6', you can simply access them as `"t6"[0]` and `"t6"[1]` respectively.

Member Avatar for sepp2k
0
116
Member Avatar for COKEDUDE

Also asked (and answered) [here](http://www.dreamincode.net/forums/topic/359353-strange-program-compiles/).

Member Avatar for vegaseat
0
193

The End.