Search:

Type: Posts; User: johngav

Search: Search took 0.01 seconds.

  1. Replies
    13
    Views
    2,305

    i think i also have to correct my main() . Am i...

    i think i also have to correct my main() . Am i right ( mind the bold )



    .....
    steps1 = 0;
    gdc1 = gcdrecurs(a1,a2,&steps1);
    printf("the gdc is %d and %d steps were needed using...
  2. Replies
    13
    Views
    2,305

    i'n not sure i get what you mean . steps1...

    i'n not sure i get what you mean .

    steps1 points to an int that is initialised to zero

    steps1=0 in function main

    i
  3. Replies
    13
    Views
    2,305

    you meant what it expects in steps1 right ? ...

    you meant what it expects in steps1 right ?


    Well steps1 is supposed to count how many times the function is called ( by it self + 1 ) . So it should be an int passed by reference in order not...
  4. Replies
    13
    Views
    2,305

    sorry my mistake

    sorry my mistake
  5. Replies
    13
    Views
    2,305

    i think it shoud expect an int since the final...

    i think it shoud expect an int since the final outcome should be a greatest common divisor
  6. Replies
    13
    Views
    2,305

    Thanks for replying I have one more question...

    Thanks for replying

    I have one more question for the first function



    int gcdrecurs(int m,int n,int *steps1 )
    {
    int temp , r ;
  7. Replies
    13
    Views
    2,305

    euclids algorithm

    Hi everyone

    I have to write a c program that calculates the greatest common divisor of two positive numbers , using the euclides algorithm . I have to implement two functions , one that works...
  8. Replies
    22
    Views
    3,079

    thanks again for all the help! Both those...

    thanks again for all the help!

    Both those solutions though would be too much for my level . Considering that i'm a newbie , i would say that the answer is probably that the mistake the function...
  9. Replies
    22
    Views
    3,079

    no it's not .Its i

    no it's not .Its i<5 not i<=5
  10. Replies
    22
    Views
    3,079

    laser i'm missing your point !I'm a newbie...

    laser i'm missing your point !I'm a newbie remember ? :-)
  11. Replies
    22
    Views
    3,079

    I see your point Kbriggs .seems like a stupid...

    I see your point Kbriggs .seems like a stupid exercise though no ? I mean how would this function not be wrong ? What would you change
  12. Replies
    22
    Views
    3,079

    laserlight , do you mean why is recursion used...

    laserlight , do you mean why is recursion used in this case? I don;t know
  13. Replies
    22
    Views
    3,079

    kbriggs i guess it is incremented after f calling...

    kbriggs i guess it is incremented after f calling and that's probably the reason it is indefinate. but how should it be?
  14. Replies
    22
    Views
    3,079

    laser , f is the name in both cases , so it is a...

    laser , f is the name in both cases , so it is a reccuring function , so ? Ican't get any further

    kbriggs the value is 1 isn't it ? , but that's not very helpful
  15. Replies
    22
    Views
    3,079

    KBriggs , no , it is an idefinat loop , i run it...

    KBriggs , no , it is an idefinat loop , i run it with dev++ and it prints n f() many many times till the execution window closes

    laser , i agree that the comment is the key , but what would be a...
  16. Replies
    22
    Views
    3,079

    tab thanks for replying. In order to see...

    tab thanks for replying.

    In order to see logical errors , there should be something asked like "this function is supposed to do "this" ..." , but there isn't .
  17. Replies
    22
    Views
    3,079

    What's wrong with this function ?

    Hello everyone

    i 'm a newbie in c and i have this exercise :

    --------------------------------------------------------------------------------
    What the error in the following function ?


    ...
  18. Thread: true or false

    by johngav
    Replies
    4
    Views
    2,563

    ok guys i get your point so what if i change...

    ok guys i get your point

    so what if i change it a bit :

    ( 4>3 ) && ( x=2 )

    would that be true ?

    Meaning , if the very next line of code is
  19. Thread: true or false

    by johngav
    Replies
    4
    Views
    2,563

    true or false

    Hello all

    I'm a novice both in c programming and this forum

    this is a true or false question :
    -----------------------------------------------------

    The following exrpession assigns 2 in...
Results 1 to 19 of 20