Search:

Type: Posts; User: Tibo-88

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. You cannot return multiple parameters from a...

    You cannot return multiple parameters from a function in C. You need either to return a struct that will contain both numbers, or use a sum function two times, one for each part.
  2. You are making computation on floats but...

    You are making computation on floats but returning ints from your function, therefore you get int values. Also you should really consider the comments from iMalc.
  3. Replies
    2
    Views
    856

    You are missing closing parenthesis line 52, 53...

    You are missing closing parenthesis line 52, 53 and 56. But you might have other problems :).
  4. Replies
    5
    Views
    2,176

    @nonoob : thanks for clarifying. But I might add...

    @nonoob : thanks for clarifying. But I might add that I would not advice taking the habit of using sizeof for computing string length, because when you switch to dynamically allocated strings, then...
  5. Replies
    5
    Views
    2,176

    "sizeof" is used to get the size of a data type,...

    "sizeof" is used to get the size of a data type, not a string. You should indeed use strlen(), which gives you the number of character in the string, excluding the null termination char '\0'.
    ...
  6. You should not use the "putw" function (it is...

    You should not use the "putw" function (it is actually for me the first time to see that function).

    As stated on the documentation, putw will write a "word" to the stream (file), but a word in...
  7. Thread: pls help me

    by Tibo-88
    Replies
    9
    Views
    1,283

    This is not a question, this is a statement for a...

    This is not a question, this is a statement for a homework that I guess you are supposed to do. A question would be : "I don't understand what the "%f" means line 7" (for example). So if there are...
  8. Replies
    4
    Views
    2,169

    In C, in order to compare two values, you must...

    In C, in order to compare two values, you must use the "==" operator. The "=" operator is used for assigning values.

    Then the second code has comparison, the literal translation would be : "is x...
  9. Replies
    2
    Views
    946

    I think a good place to start would be to read...

    I think a good place to start would be to read the datasheet, for both your components! (the other datasheet)
  10. It seems like the problem is in the ASM part, but...

    It seems like the problem is in the ASM part, but I don't remember enough of my ASM classes to help you with that.

    Also it seems like only src2 is causing issue, because the following code is...
  11. Thread: /*word wrap*/

    by Tibo-88
    Replies
    1
    Views
    1,084

    And your question...

    And your question is?
  12. Could you show the working program with the input...

    Could you show the working program with the input string set in the main? I tried to modify your program by setting the strings inside the program and it still leads to SEGFAULT in the ASM code part.
  13. Replies
    4
    Views
    1,224

    Take a look at this...

    Take a look at this, I think it will help you.
  14. The 9 and the 6 are the max length of the strings...

    The 9 and the 6 are the max length of the strings for each array. For example, in the first array, the biggest string is "Diamonds", which is 8 characters, plus the '\0' at the end => 9. Same for the...
  15. Thread: Stack Problem

    by Tibo-88
    Replies
    15
    Views
    3,051

    In order to free the memory, you need a pointer...

    In order to free the memory, you need a pointer to the address of that memory. So you always need to keep a valid pointer to a dynamically allocated memory, otherwise, this memory will be "definitely...
  16. Thread: Stack Problem

    by Tibo-88
    Replies
    15
    Views
    3,051

    Take a look at the definition of a local variable...

    Take a look at the definition of a local variable on Wikipedia, I think it might help you.

    If you notice in my previous post I put the destroyed word between quotation marks, because the memory...
  17. Thread: Stack Problem

    by Tibo-88
    Replies
    15
    Views
    3,051

    I don't know Turbo C++, but I recall a lot of...

    I don't know Turbo C++, but I recall a lot of people saying that it is outdated on this forum.

    But anyway, your problem remains the same, the local variable is "destroyed" when the program exits...
  18. Thread: Stack Problem

    by Tibo-88
    Replies
    15
    Views
    3,051

    Enable the warnings in your compiler, you should...

    Enable the warnings in your compiler, you should see "warning: function returns address of local variable".

    In fact you are returning the address of a local variable (k), which means that you can...
  19. Replies
    30
    Views
    4,383

    It is actually possible to make it without the...

    It is actually possible to make it without the "&&", but then the logic will be different.

    I usually don't like to give so detailed answer, but you seem like you thought quite a lot, so I will...
  20. Replies
    30
    Views
    4,383

    First, I did not notice from the beginning, but...

    First, I did not notice from the beginning, but take some time to read this page.

    Then "x>y>z" is not good, that is not the proper way to do it. You have to compare if x>y AND x>z, by using the...
  21. Replies
    30
    Views
    4,383

    It is not a problem about single digit or double...

    It is not a problem about single digit or double digit, it is just about the code logic. Again, what you want to check in your if and if else statement is for example x > y AND x > z which is the...
  22. Replies
    30
    Views
    4,383

    I'm sorry to disappoint you, but the logic is...

    I'm sorry to disappoint you, but the logic is still not good. What if x > y but z > x? Then your program will print x, even if z is bigger than x.
  23. Replies
    30
    Views
    4,383

    I'm happy if you succeed to make it work, but it...

    I'm happy if you succeed to make it work, but it seems like the code you just posted is exactly the same than before :)!
  24. Replies
    30
    Views
    4,383

    Your problem is what you want, is for example to...

    Your problem is what you want, is for example to print the value of x if x is the biggest number, not only if x is bigger than y (same for the other conditions). So what you should test, is if x is...
  25. Replies
    1
    Views
    1,085

    That's why the code in the if block is executed...

    That's why the code in the if block is executed by the child process, but not by the parent. Does it answer your question?
Results 1 to 25 of 80
Page 1 of 4 1 2 3 4