Search:

Type: Posts; User: ~C_Student~

Search: Search took 0.00 seconds.

  1. Replies
    10
    Views
    4,984

    help with srand()

    im writing a simple lotto simulator, not finished, but i when drawing the numbers they are all the same unless a lot of time goes by

    Im using srand() like this



    srand(time(NULL));
    ...
  2. Replies
    3
    Views
    1,153

    Help with structures

    I was wondering if someone could explain whats happening here, im supposed to make my own functions for iv_new, iv_push and iv_get, but i don't understand the structures that are given


    ...
  3. Replies
    9
    Views
    6,926

    thanks, it is now compiling, and generating a...

    thanks, it is now compiling, and generating a num, but its the same number everytime
  4. Replies
    9
    Views
    6,926

    Problem with random number

    I keep getting this error when trying to compile



    int gen_rand(void) {
    int n;
    n = random(100); /* n is random number in range of 0 - 99 */
    return(n);
    }
  5. because \n is an escape key

    because \n is an escape key
  6. i think my ps_set is wrong because i just added a...

    i think my ps_set is wrong because i just added a printf statement to tell me the length

    and "hello " = 6
    and "world\n" = 6

    but world is only supposed to be 5 :S
  7. well my output is 1 0 -1 helloworlo ...

    well my output is


    1 0 -1
    helloworlo


    supposed to be
  8. i have got it almost working, my output is just a...

    i have got it almost working, my output is just a bit weird, im gonna stop posting my code in case other students in my class start using my code as well, most of the code from my previous posts has...
  9. but im passing it an array that contains chars......

    but im passing it an array that contains chars...


    int i;
    for (i = 1; i < dest[0]; i++) { //dest[0] has the length of the array in this spot
    printf("%s", dest[i]); //error is...
  10. what does this error mean, i been messing with it...

    what does this error mean, i been messing with it but can't make it go away



    new.c: In function ‘ps_put’:
    new.c:87: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’
  11. Thanks for explaining that it totally makes sense...

    Thanks for explaining that it totally makes sense now, im gonna go see if i can code it now
  12. So if im putting two strings together lets say: ...

    So if im putting two strings together lets say:

    a = "world"
    b = "hello "

    in my program it is called like this



    ps_cat(b,a);
  13. Ok so i think i got the ps_set function done,...

    Ok so i think i got the ps_set function done, hows it look



    void ps_set(pstring dest, const char *test){
    int i, b, len;
    for (i = 1; i != '\n' && b <= PSTRING_MAX; i++) {
    dest[i] =...
  14. ok so i just worked this out on paper. example:...

    ok so i just worked this out on paper.
    example: " ps_set(a,"hello") "
    would put the word "hello" in an array starting at a[1]





    void ps_set (pstring dest, const char string){
    int i = 1,...
  15. Yes i am getting over whelmed by the entire...

    Yes i am getting over whelmed by the entire program.

    I have been looking everywhere about this, and people are saying that it would be pointless to rewrite the functions because they are about...
  16. Help - rewriting style of string library in C

    Hello im an 2nd year university student, and i am stuck on an assignment.

    I am supposed to store the length of the string in the zero'th element of the array, and the remaining characters after....
Results 1 to 16 of 16