for the codes under for loop this error massage is showing
19:37 C:\Users\azr\Desktop\Untitled1.c invalid suffix "xy" on integer constant

#define func(x,y) 3xy

int main()
    int x0,y0,n,y1,k1,k2,k3,k4,h;
    printf("enter the values");
    printf("enter x0:");
    scanf("enter x0:%d",&x0);
    printf("enter number of x values:");
    scanf("no. of x values:%d",&n);
    printf("value of hight h");
    scanf("value of hight h is :%d",&h);
    printf("the value of y0");
    scanf("the value of y0 is :%d",&y0);


can any please help me with this !!!!

#define func(x,y) 3xy <-- This dosent makes sense. 3xy should be an integer, yours is like a string.

Refer to MSDN and for proper usage of preprocessors.

What about #define func(x,y) 3 * x * y?

What about #define func(x,y) 3 * x * y? That is valid.

It's valid, but it very likely won't do what the OP wants it to. You'll need parentheses around the arguments and the whole expression (though the latter doesn't matter in this case).

Or they could make their life 1000 times easier and define it as a function instead of a macro.

thanks a lot. it worked!
@sepp2k i cant understand your suggestion.can you make it clear for me please??

You mean about adding parentheses or using a function? For the former I meant that it should be #define func(x,y) (3 * (x) * (y)) or you'll get wrong results because of precedence in the expanded code.

For the latter I meant that you should just use int func(int x, int y) { return 3 * x * y; } and avoid any such issues.

should i have to mention the type such as int,char etc while defining a function
like you have written

int func(int x, int y) { return 3 * x * y; }

and why it is necessary to declare the type and as well as the return statement??

Yes, according to ANSI C, you need to specify the return and argument types when defining or declaring a function. Not doing so is an error.

You need the return statement because the return statement is used to return values from a function. If you use the return value of a function, but that function did not return a value using a return statement, the behavior is undefined (even in pre-ANSI C).

It might seem to you that using a macro (which doesn't require any types or return statements) might be easier because of this, but as we just saw, using macros means that you have to be very careful with parentheses if you want to get correct results. So not using macros will save you a lot of pain and is definitely worth it.

It's not called "Macro Hell" for no reason. ;)

so you are suggesting to creat a user defined function and call it to get the value for k1,k2,k3 ??

It depends, but I have had some defines written by others, that just brought the work to a screeching halt, while we figured out WTH these defines were doing.

clever cute defines - I hate them, and pray to the gods to strike them down to hell! ;)

seems you had a lot of troubles with macro defines when you have learnt them ;). i will try it with user defined function .hope to post the codes here