- Strength to Increase Rep
- +8
- Strength to Decrease Rep
- -2
- Upvotes Received
- 31
- Posts with Upvotes
- 25
- Upvoting Members
- 21
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
Re: My industry experience is not impressive and not in your industry, so take the following with a grain of salt. I once knew a developer for a major company who would often travel to deliver training lectures for corporate clients. You might research companies that offer training for their product … | |
Re: Second what WaltP says, plus don't use scanf for interactive user input, check the return values of standard library functions, and use fflush(stdout) after printing a prompt that doesn't end with '\n' to make sure it gets printed. 1 is not a portable value to pass to exit(), and returning … | |
Re: > I may be mistaken but I believe you have to by *\[sic]* QT If the rest of your post is also 12 years out of date, I'm not sure why I bothered reading it. > Few would be developing VB.net apps with GUIs without using an environment that removes … | |
Re: > there is no problem to do backward or frontward in single linked, as long as it is only one way to go needed, is more needed is both or one ? or you just go from start agayn to that spot you need. Or depends how much back you … | |
Re: Ancient Dragon is correct, but I'd like to point out that there is a difference between char *str = "Test"; /* and */ char str[] = "Test"; In both cases, "Test" is a string that resides in read-only memory. In the first case, `str` is a pointer object that is … | |
Re: I agree with pyTony, recursion seems like an odd way to solve this problem. However, you should be able to get your original version to work if you give it an array that can be modified (untested): int main(void) { char *charset="abcdefghij"; char buffer[100] = ""; recurse(buffer,charset); } When you … | |
Re: Which is why you should instead use array = malloc(ROWS * sizeof *array); Also don't cast the result of malloc(), it suppresses warnings and serves no useful purpose. deceptikon's solution was in every way superior. | |
Re: $x += $y means the same thing as $x = $x + y with the exception that `$x` is evaluated only once -- this would only make a difference if evaluating $x had side effects (e.g. when it's not really a variable but actually a subroutine call). You can use … | |
Re: I'm going to guess you meant to post something more like this: #include <stdio.h> int main(int argc, char *argv[]) { if (argc != 2) { printf("usage: %s filename", argv[0]); } else { FILE *file = fopen(argv[1], "r"); if (file == 0) { printf("Could not open file\n"); } else { int … | |
Re: Schol-R-LEA has an overall good analysis. I'll comment on three points. * Everybody you ask will have a different opinion on what editor or IDE to use. Personally I use Vim but I usually recommend jEdit for newbies; it has a good user interface, available on anything Java runs on, … | |
Re: You didn't ask a question, so I'm assuming you want feedback. * `void main()` is a non-standard extension to the C language. Prefer `int main(void)` (or `int main(int argc, char *argv[])` when you want to use command line arguments). * `<conio.h>` is also non-standard and also very very old. Don't … | |
Re: When you declare an array (or any object) within a function, the memory allocated for it has *automatic storage duration*, meaning that once the name it was declared with goes out of scope, trying to access the memory (via e.g. a persistent pointer, like you have done) results in undefined … | |
Re: Why do you need an array that size? How would you rewrite your program so that such a large array is not necessary? | |
Re: Nope. The first part of a 3-statement `for` clause is run only once, before the first test or the first execution of the loop body. The equivalent would be more like mytype = 500 for x in range(filearray_count): ... That said, 500 seems to be somewhat arbitrary since you don't … | |
Re: Nope. If you want it to do something when you run it from the command line, you need to put code in the top level of the file (not in a function). You can easily make your script behave this way, though, if you add the following code to it: … | |
Re: This looks odd to me: foreach $line (@L1) { $line =~ s/,,,/,/g; print @L1; } Sure you want to print all of @L1 every time through that loop? As for your output, I can't tell what you expect it to do. Could you post your input and describe what you … | |
| Re: The question has been marked as solved, so I don't know whether you're still expecting answers... When you find yourself calling static methods from non-static methods or vice versa, it means you haven't thought about the problem enough. You actually answered your own question after a fashion, if you take … |
Re: Since you're not instantiating any objects of class Die, *anything* you want to use must be declared `static`. That includes all the variables that are defined directly within the class as well as the die() method. That said, you don't have code showing how you expect to use the Die … | |
Re: Easiest C version, guaranteed. Probably won't work under Windows though. #include <stdio.h> #include <stdlib.h> char const * const lines[] = { "my %files;\n", "while(<>) {\n", " my($index) = /(\\d+)$/;\n", " $files{$index} .= $_;\n", "}\n", "for(keys %files) {\n", " open OUTPUT, '>', \"File$_.txt\";\n", " print OUTPUT $files{$_};\n", " close OUTPUT;\n", "}\n", … | |
Re: For values of `voltage` less than 4200, you'll always get zero. This is because of the way integer arithmetic works. [Relevant C FAQ link.](http://c-faq.com/expr/truncation1.html) | |
Re: That's certainly one *valid* way to pass multiple values to a function, but it's not *advisable*. Your proposed solution is overly complicated, which makes it hard to document, hard to read, and hard to debug. Furthermore, it seems in your case to be totally unnecessary. Since you're not doing anything … | |
Re: > I'm using VS2010 compiler. when i use as above statement it didnt give any build error. it built fine and execute fine Cool story bro. According to section 6.4.4.4 of C99, the behavior of a multi-character single-quoted constant like '50' is implementation-defined. A diagnostic is not required in this … | |
Re: Do you see why the result is 0x1.9cccccp3? I don't think you can do any better than that with the standard library. Converting fractions into other bases is not a very common need (unlike integers, which are quite handy to have in base-N sometimes.) What you might do with a … | |
Re: You mean like [CODE]System.out.printf("%4.2f\t%4.2f\n", var1, var2);[/CODE] Check out the Java API for PrintStream and Formatter to see details on printf. | |
Re: I think I understand why -- printf("%s\n", s) can be optimized to puts(s). That said, this is EXACTLY why you shouldn't ever rely on undefined behavior -- because it does weird things you can't predict and is affected by apparently unrelated changes in ways you can't anticipate. Any attempt to … | |
Re: I'm trying, but I can't figure out how your output follows from your input. Can you explain the problem more clearly? | |
Re: atoi() has no way to recover from errors. Use strtol() as subith86 suggested. Should you actually want to test whether a character is a digit, don't perform contortions; #include <ctype.h> and use isdigit instead. | |
Re: Generally speaking, anywhere in C you would see a call to malloc(), in Java (or C++) you'll find the word [B]new[/B] instead. This also applies for strings, but strings are a little bit special in that there is a unique syntax for creating them (using "...") that doesn't use [B]new[/B]. … | |
Re: [CODE]WELCOME TO FORUMS, puppycrazy WOULD YOU LIKE TO ANNOY YOUR USERS?(Y/N) : y IN THAT CASE PLEASE CONTINUE USING ALL CAPS WOULD YOU LIKE TO GET GOOD ANSWERS?(Y/N) : y IN THAT CASE PLEASE CONSIDER PROOFREADING YOUR POSTS TO ENSURE THEY MAKE SENSE. ALSO,PLEASE!AVOID>USING~WEIRD.......><....PUNCTUATION, SPACES EXIST FOR A REASON[/CODE] |