Thank you - very clear.
Type: Posts; User: sjmp
Thank you - very clear.
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...
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
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...
Makes sense. Thanks for the info.
rcgldr - when you say:
you mean for that specific instance/example only - because in this instance i = 0
correct?
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...
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...
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...
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...
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...
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.
...
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()...
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...
For a HW assignment I have to create a structure called Article
typedef struct
{
int number;
int quantity;
char description[STR_LEN+1];
} Article;
Thank you very much. you explanations are very helpful. I understand much better now.
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...
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...
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
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...
I deleted the post you are referring to. I was trying to redo it, but it was wrong. Please refer to #19
Here is my current code:
defs.h
#ifndef _max_
#define MAX2 ((x > y) ? x : y)
#define MAX3 ((MAX2 > z) ? MAX2 : z)
#endif
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...
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.
...
No I do not understand why it was recommended. Please explain.