Search:

Type: Posts; User: sjmp

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Thank you - very clear.

    Thank you - very clear.
  2. Overflow example and order of memory allocation

    Small code to show overflow

    But when I compile and run - buffer_one is not being overwritten when the byte size of buffer_two overflows - can someone please explain why?


    #include...
  3. Replies
    4
    Views
    1,637

    Thank you - I just noticed it while comparing...

    Thank you - I just noticed it while comparing back to the original. I spent a few hours looking at permissions. I hope one day I get a grip on this. Thanks again
  4. Replies
    4
    Views
    1,637

    Error using File Descriptor

    HelloI am trying to figure out why I am getting an error (-1) when tryingto write to a file.

    Hereis the function - I did not include the rest of the code - not sureif I am leaving anything else...
  5. Replies
    9
    Views
    2,431

    Makes sense. Thanks for the info.

    Makes sense. Thanks for the info.
  6. Replies
    9
    Views
    2,431

    rcgldr - when you say: you mean for that...

    rcgldr - when you say:

    you mean for that specific instance/example only - because in this instance i = 0

    correct?
  7. Replies
    9
    Views
    2,431

    Grumpy - I appreciate the clarification. Do you...

    Grumpy - I appreciate the clarification. Do you know why every instance of the static variable var (in this instance) is assigned the same memory address? I do not understand how memory is...
  8. Replies
    9
    Views
    2,431

    Static variable initialization

    Is this comment correct based on the code below: I was confused why var did not increment in each loop and why static_var did.

    Is this correct: In the context [in function] var = 5 and is...
  9. Replies
    2
    Views
    1,989

    Pass an array to a function

    Can someone please narrate this code for me? I do not understand why we create:
    1. void testfunc (int a[]) before main()
    2. testfunc ( a) - in main()
    3. void testfunc again after main.

    can...
  10. Replies
    11
    Views
    2,106

    Thanks laserlight that was very helpful. I...

    Thanks laserlight that was very helpful. I renamed the inclusion guard and removed
    struct Article *art_1; completely. Now it works fine. I do not understand why I am using a pointer Article.art_1...
  11. Replies
    11
    Views
    2,106

    I added it based on an error in the compiler:...

    I added it based on an error in the compiler: This is what I get if I add it back. Without it I get unexpected type and missing function header
    1>header.h(11): error C2226: syntax error : unexpected...
  12. Replies
    11
    Views
    2,106

    Can someone please help me figure out what is...

    Can someone please help me figure out what is wrong here. Not clear on how to define the struct name after declaring the struct itself. And void print does not like me using the keyword struct.
    ...
  13. Replies
    11
    Views
    2,106

    Let me try to take a step back and accomplish...

    Let me try to take a step back and accomplish this in steps.
    Here is the HW -
    1. Create Article which the contents are assigned at initialization level
    2. Printing the Article is done w Print()...
  14. Replies
    11
    Views
    2,106

    So i went back and did some reading but I am...

    So i went back and did some reading but I am still confused on the use of typedef vs. tag, when do I need an Alias for the struct, and do not have a clue how to use a pointer to the struct.I cannot...
  15. Replies
    11
    Views
    2,106

    Structures and Pointer

    For a HW assignment I have to create a structure called Article


    typedef struct
    {
    int number;
    int quantity;
    char description[STR_LEN+1];
    } Article;
  16. Replies
    5
    Views
    4,769

    Thank you very much. you explanations are very...

    Thank you very much. you explanations are very helpful. I understand much better now.
  17. Replies
    5
    Views
    4,769

    combined conditions in For loop

    For the for loop below each outputs 4,3,2,1,0 - how does this work exactly?

    the first loop:
    for (p=a+4, i=0; i<=4; i++) PRD(p[-i]);

    is this just that we start at p[4] and keep going down...
  18. Replies
    32
    Views
    43,245

    Got it. I did not think I could use MAX2 in the...

    Got it. I did not think I could use MAX2 in the definition of MAX3 this way. But I do understand how this solution works. Thanks for all's help. Must be frustrating to have so many people not get...
  19. Replies
    32
    Views
    43,245

    So this is as far a I have gotten. Stuck on MAX3....

    So this is as far a I have gotten. Stuck on MAX3. Am I on the right track?



    #ifndef MAX
    #define MAX2(x,y) ((x>y) ? x : y)
    #define MAX3(MAX2,z) ((MAX2 > z) ? MAX2 : z)
    #endif
  20. Replies
    32
    Views
    43,245

    iMalc, I wrote MAX2 as: #define MAX2(x,y)...

    iMalc,

    I wrote MAX2 as:
    #define MAX2(x,y) ((x>y) ? x : y)

    Now in defining MAX3 I need to use MAX2 - but I does not look like I can use the macro name of MAX2 in this macro function

    It...
  21. Replies
    32
    Views
    43,245

    I deleted the post you are referring to. I was...

    I deleted the post you are referring to. I was trying to redo it, but it was wrong. Please refer to #19
  22. Replies
    32
    Views
    43,245

    Here is my current code: defs.h #ifndef...

    Here is my current code:

    defs.h


    #ifndef _max_
    #define MAX2 ((x > y) ? x : y)
    #define MAX3 ((MAX2 > z) ? MAX2 : z)
    #endif
  23. Replies
    32
    Views
    43,245

    I think I get your point(s) - this is not the way...

    I think I get your point(s) - this is not the way to use a function macro. Got it. But how would I do it better for my assignment.

    Create 2 macros (Max2(x,y) & MAX3(x,y,z) which must return the...
  24. Replies
    32
    Views
    43,245

    So my macro functions max2, max3 should not be...

    So my macro functions max2, max3

    should not be the conditional ops that solve the problem? I have to initialize the variables in the function main. I have to use MAX2 to solve for MAX3.
    ...
  25. Replies
    32
    Views
    43,245

    No I do not understand why it was recommended....

    No I do not understand why it was recommended. Please explain.
Results 1 to 25 of 59
Page 1 of 3 1 2 3