Search:

Type: Posts; User: Nemooo; Keyword(s):

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    19
    Views
    1,406

    Re: Generating random numbers in C

    Depending on how important the randomness is required to be, you might want to read Using rand() and eventually Random Numbers by the same author.
  2. Replies
    29
    Views
    1,453

    Re: Assembly and Linux

    I don't know whether I should post this link or not. The site's fine legally and is perhaps more what you seek. Try browsing a little around.

    http://hackthissite.org/
  3. Replies
    5
    Views
    720

    Re: Why can't main() return void type? C++

    Your program should return an int to tell the OS whether it was executed succesfully or not. O tells it that everything went well and others will mean an error happened.
    ...
  4. Replies
    8
    Views
    206

    Re: Passing a Linked List to a Function

    And from what I gather from the error message, what I said should fix your problem, but post back when you've tried it.
  5. Replies
    8
    Views
    206

    Re: Passing a Linked List to a Function

    You don't declare the variable to be global, it's still declared in main and then passed to another function. It's just the struct "prototype" you have to declare in a global scope.
    ...
  6. Replies
    8
    Views
    206

    Re: Passing a Linked List to a Function

    If the struct is declred in main, it only exists in that function. If you want other structs to acces the struct, you have to declare it globally (or at least that's how it is in C):


    struct...
  7. Replies
    23
    Views
    2,081

    Re: Beginners Challenge #6

    Okay here is my final entry. Still basic C, but with some more options.

    My main focus wan't a lot of features, but a simple working implementation - well moduralised and commented. Just for...
  8. Replies
    23
    Views
    2,081

    Re: Beginners Challenge #6

    Here's a really basic one in C. I don't feel like adding a bunch of commandline arguments right now, so it just takes the string to be searched for as the first argument (and therefore can't include...
  9. Replies
    46
    Views
    2,970

    Re: Hackers and Common Lisp

    I'd definately recommend Lisp, though go with Scheme at first. I tried starting out with Common Lisp along with Practical Common Lisp, and it was too much format syntax for my head combined with...
  10. Replies
    7
    Views
    306

    Re: General Programming Statements

    The straight forward answer to your question would be that the bracket placement is different for different control structures. One way to visualise this (as in your example) is by putting brackets...
  11. Re: want to learn new programming language, advice?

    Coming from Java you want gain a lot from learning C++ besides new syntax, as it's a language encouraging OOP, (although it strictly speaking is a multiparadigm programming language) just as Java.
    ...
  12. Replies
    2
    Views
    211

    Re: About Code Reuse?

    Just compile the other file, too, i.e if you have a file main.c and it's calling a function inside another file call.c:


    gcc main.c test.c

    If you're including a header, you still have to add...
  13. Replies
    12
    Views
    5,999

    Re: cc/gcc and why is there a difference?

    In Ubuntu (and most other Linux distributions I guess) cc is gcc. Try gcc --version and compare it to cc --version.

    The difference between your "Hello World" examples are probably just what the...
  14. Thread: C==c++

    by Nemooo
    Replies
    12
    Views
    911

    Re: C==c++

    Do the brackets inside main serve any purpose? I've never seen them used like that before.
  15. Replies
    56
    Views
    1,875

    Re: Keyboard Typing Style Survey!

    That's nothing compared to what real programmers do : )
  16. Replies
    6
    Views
    1,374

    Re: while(getchar() != '\n'); how does that work?

    After using fgets i use this little function to avoid the problem you're experiencing. Just as while(getchar() != '\n'); it eats what's left in the buffer, so this isn't mistakenly taken as input...
  17. Replies
    2
    Views
    2,370

    Re: get number of lines in a text file c/c++

    I don't know if this is faster. Basically it's just counting the number of characters until it reaches EOF.


    int line_num(char *filename)
    {
    FILE *f;
    char c;
    int lines = 0;

    f =...
  18. Replies
    15
    Views
    4,997

    Re: fflush() or fpurge()? Neither work...

    strchr() returns a pointer to the first occurence of '\n' in the string (char array). If strchr find no occurence of '\n' it means that there was no room for it, so the user must have entered...
  19. Replies
    15
    Views
    4,997

    Re: fflush() or fpurge()? Neither work...

    You don't need an array of 3 chars, if you just want to get one char as input. The newline is only appended, if there's room for it. This works fine for reading and printing a character. And if you...
  20. Re: C program simply does not run, but with no error message

    You'll want to include the header stdio.h, because it contains the puts() function. All explained here:

    http://ubuntuforums.org/showthread.php?t=689635
  21. Replies
    24
    Views
    755

    Am I stupid or is there no way to delete a post?

    Am I stupid or is there no way to delete a post?
  22. Replies
    24
    Views
    755

    Re: C++ Variable Help

    Don't you think an array would suit your purpose?


    int variable[10]

    for(i = 0; i < 10; i++)
    variable[i] = something
  23. Re: passing an array by reference in c?

    Wrong. Arrays are always passed by reference. If it was passed by value (as you say) this wouldn't print zbc, but abc:


    #include <stdio.h>

    void func(char *arr)
    {
    arr[0] = 'z';
    }
  24. Re: passing an array by reference in c?

    The ampersand (&) is not needed, it's just:


    int tune(note *tuning, int *strings, const char *tunestr)
    {
    ...
    }

    int main(int argc, char** argv)
    {
  25. Replies
    10
    Views
    316

    Re: [C] Small segfault problem

    Another thing you should change is the declaration of main(). Since main always is returning a value to the OS to tell whether the program succeeded or not, main() should be declared as returning an...
Results 1 to 25 of 85
Page 1 of 4 1 2 3 4