Search:

Type: Posts; User: TheBigH

Page 1 of 18 1 2 3 4

Search: Search took 0.02 seconds.

  1. Python. I have found that with C, Python, and...

    Python.

    I have found that with C, Python, and a little bit of shell scripting, I have no conceivable need for anything else.
  2. Replies
    6
    Views
    2,647

    Actually, if you pass an integer to a function...

    Actually, if you pass an integer to a function that expects a double, the integer gets automatically promoted to a double.

    The problem with this program is that you're printing the address of...
  3. Replies
    5
    Views
    750

    Okay, let's say you want to check whether square...

    Okay, let's say you want to check whether square #161 is on any border.
    The row number is then 161 / 15 = 10 (remember that this is integer division, remainders get thrown away)
    The column number...
  4. Replies
    3
    Views
    1,071

    Check out ncurses.

    Check out ncurses.
  5. Replies
    3
    Views
    667

    At the end of the while loop, you free(temp) and...

    At the end of the while loop, you free(temp) and thereby make "present" point to freed memory. You should make present point to something that exists before the next iteration of the while loop.
  6. Replies
    10
    Views
    1,654

    So your problem is that there is a star at the...

    So your problem is that there is a star at the end of the string, but you don't want it there?

    Why not loop down to 2, and then print the last 1 outside the loop?
  7. OK, what are you having trouble with?

    OK, what are you having trouble with?
  8. Replies
    4
    Views
    2,008

    Basically, each link in a linked list is a...

    Basically, each link in a linked list is a structure containing two things: the data you're storing, and a pointer to the next link in the list.

    What have you tried? Show us your code.
  9. Replies
    11
    Views
    2,153

    Can you show your whole code? What errors are you...

    Can you show your whole code? What errors are you getting?
  10. Replies
    10
    Views
    1,167

    Why does SIZE need to be an array in the first...

    Why does SIZE need to be an array in the first place?
  11. Replies
    10
    Views
    1,167

    In line 2 you probably want "int *size". You...

    In line 2 you probably want "int *size". You forgot the asterisk.
  12. Replies
    12
    Views
    1,174

    Q1) One way to approach this would be to make a...

    Q1) One way to approach this would be to make a new variable that counts how many of x,y,z are true.

    Q2) C syntax does not allow things like


    if( a < x < b) /* do stuff */


    You need to...
  13. Good. So if the number of the row (variable i) is...

    Good. So if the number of the row (variable i) is equal to the number of the column (variable j) print a 5, otherwise print a @.

    If I just hand out the code you won't learn anything, but the...
  14. That's a good start, your code prints a square of...

    That's a good start, your code prints a square of @ symbols.

    Inside your "j" loop you'll need an if statement that decides whether to print a @ or the digit.

    If I'm in row 2, column 4, do I...
  15. Replies
    2
    Views
    848

    Your code does not even compile, because you...

    Your code does not even compile, because you don't declare many of the variables you're reading. I can also tell that, even if they were declared, you're not handling firstname and lastname right;...
  16. Replies
    4
    Views
    874

    Here's a neat little trick: ...

    Here's a neat little trick:



    round_to_nearest_int( double x ) {
    return floor( x + 0.5 );
    }


    Can you figure out for yourself why this works?
  17. It's a subtle little bug. If the string contains...

    It's a subtle little bug. If the string contains an 'A' or an 'a', then keyword[j] gets set to zero. Once that happens, keyword[j] = 0 = '\0' = end of string. So strlen(keyword) thinks the string...
  18. Replies
    5
    Views
    826

    Do you even know what data type your fib variable...

    Do you even know what data type your fib variable is supposed to be? You declare it as a pointer to an integer, then you set it to an integer with the function "a", then you treat it as an array of...
  19. Replies
    5
    Views
    826

    Set b[0] and b[1] before your loop. Also, in...

    Set b[0] and b[1] before your loop.

    Also, in line 11, you're missing the opening square bracket in b[i-2].
  20. Replies
    8
    Views
    1,065

    Let me talk you through what is happening. On...

    Let me talk you through what is happening.

    On the first iteration of the loop, it tests whether a[0]<a[1]. If that's true then "return 1" happens, which halts the "sorted" function with a return...
  21. Replies
    2
    Views
    1,055

    If you used the array directly, the final newline...

    If you used the array directly, the final newline would be put into the array. This code looks like it is intended to avoid that.
  22. Do you know beforehand how many words there are,...

    Do you know beforehand how many words there are, and how long the longest word is? If so,



    char Words[NUMBER_OF_WORDS][LENGTH_OF_LONGEST_WORD+1]; /*the +1 leaves room for the \0 that terminates...
  23. Replies
    6
    Views
    888

    Um, the problem is exactly what the error message...

    Um, the problem is exactly what the error message says. You check the value of "input" in the while statement, but the scanf that assigns things to it happens after the first check.

    Try this as...
  24. Replies
    3
    Views
    2,884

    Use == instead of = to test equality.

    Use == instead of = to test equality.
  25. Replies
    7
    Views
    1,110

    Yes, fgets...

    Yes, fgets.
Results 1 to 25 of 428
Page 1 of 18 1 2 3 4