Search:

Type: Posts; User: noobiept

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Thread: Getchar

    by noobiept
    Replies
    9
    Views
    1,783

    don't change your string pointer. this:...

    don't change your string pointer.

    this: string=string+1;
    you loose the beginning of your string.

    Try this instead: string[i] = getchar();
    (you would need an i variable that gets incremented...
  2. Replies
    19
    Views
    86,863

    I can't see a problem there, but you've got alot...

    I can't see a problem there, but you've got alot of if else statements there. When one of them evaluates to true, the rest is bypassed, so maybe that's where the problem occurs.

    For example if...
  3. Replies
    19
    Views
    86,863

    can you post more of your code?

    can you post more of your code?
  4. Replies
    19
    Views
    86,863

    That's because the first if is going to evaluate...

    That's because the first if is going to evaluate to true, and jumps the else if.
    You could try having the if (a == 0 && b == 0) first, and then the if (a== 0), changing the order.

    or you could, ...
  5. Replies
    5
    Views
    27,868

    you aren't changing the variable index, so your...

    you aren't changing the variable index, so your loop is stuck.

    count is doing nothing as well.
  6. Try converting the number to string (you can use...

    Try converting the number to string (you can use sprintf for that).

    Then you can travel through that string (with a pointer) and compare each character separately, and then add to the counter.
  7. thought of another way, you could make a loop on...

    thought of another way, you could make a loop on main, but you would loose the first value(since you would be changing the same variable)
  8. I wonder what is the idea of that sort of rule,...

    I wonder what is the idea of that sort of rule, but anyway, why not just copy past the code and change the variable names?
    Kinda stupid, but works :p
  9. Replies
    9
    Views
    2,211

    you can change the order that you print to the...

    you can change the order that you print to the screen.
    For example, printf("...", b, c, d, e, a);

    Kinda of a trick, since you're not really changing anything.

    If you want to use that function...
  10. why can't you pass parameters?

    why can't you pass parameters?
  11. Replies
    9
    Views
    2,211

    you're calling your function with char variables,...

    you're calling your function with char variables, but then you use char pointers in the function, that's what the message is saying.

    Either way, what do you mean by shifting the value?
  12. Replies
    17
    Views
    2,513

    For me, the less you mess around with banks the...

    For me, the less you mess around with banks the cheaper it is. They just want you to signup to tons of "services", so that they can take their cut out of it.
  13. Thread: Error in C

    by noobiept
    Replies
    13
    Views
    1,580

    you should send the size of the strings as a...

    you should send the size of the strings as a parameter.

    also in the first loop, is probably not doing what you think, you're comparing a single character, *old_s(and it is always the same),...
  14. Thread: char = int

    by noobiept
    Replies
    14
    Views
    2,628

    you have consecutive ifs, so each one is going to...

    you have consecutive ifs, so each one is going to be evaluated every time.
    You could try instead something like this:


    if (...)
    {}
    else if (...)
    {}
    else if (...)
    {}
  15. Replies
    11
    Views
    2,726

    I think you didn't understand what I was saying,...

    I think you didn't understand what I was saying, but either way I search a bit and read about it.
    thanks for the answers!
  16. Replies
    11
    Views
    2,726

    I was referring to the order of evaluation, and...

    I was referring to the order of evaluation, and not the operator precedence (or maybe I'm confusing myself?)
  17. Replies
    11
    Views
    2,726

    Ok, I was assuming that operator precedence would...

    Ok, I was assuming that operator precedence would determine the order of evaluation. Didn't know it was something different.
    Guess I learned something today :)

    Just a last question, how do we...
  18. Replies
    11
    Views
    2,726

    I still don't get it, because the || is been...

    I still don't get it, because the || is been evaluated first. Doesn't having higher precedence means that it is evaluated first? This way the && isn't even considered.
  19. Replies
    11
    Views
    2,726

    About precedence of && and ||

    Hi, while I was helping in some programming exercises, there was this problem:


    int i = 1, j = 1, k = 1;

    printf("%d ", ++i || ++j && ++k);
    printf("i:%d j:%d k:%d", i, j, k);


    I checked...
  20. Replies
    8
    Views
    22,895

    Nope, when you do &i, you were getting a pointer...

    Nope, when you do &i, you were getting a pointer to pointer to int.
  21. Replies
    8
    Views
    22,895

    why a int* ?

    why a int* ?
  22. Replies
    10
    Views
    1,321

    If you know you have to take one loop out, why...

    If you know you have to take one loop out, why don't you like, try it :)
  23. Replies
    27
    Views
    3,503

    it seems what you're instructor is expecting is...

    it seems what you're instructor is expecting is something more easy, like asking for the numbers and operations separately, and have a cycle to do more operations.
  24. Thread: Simple Math

    by noobiept
    Replies
    15
    Views
    2,548

    you could try code::blocks (an IDE), it keeps the...

    you could try code::blocks (an IDE), it keeps the console window open, no need for extra code.
  25. Replies
    10
    Views
    1,276

    yep, was just thinking now and wasn't sounding...

    yep, was just thinking now and wasn't sounding right. you're right.
Results 1 to 25 of 74
Page 1 of 3 1 2 3