I do not understand what identifier is excepted in my dsoptlow.h.
I was practicing creating function declarations in headers. This should swap 2 values using only 2 variables and returning same variables, but with swapped values.
However during compilation this error message is shown and I have no idea what I got wrong or mistyped:
error: expected identifier or '(' before 'int'
Also, if you can give a better version for my function to return multiple values it would be very much appreciated.
And last but not least, does a type defined in a function definition return that type in main function? So does it return a struct I defined as a new type, or integer?
The following code is my header.
#ifndef _dswapoptlow_h
#define _dswapoptlow_h
struct dswap_opt_low(int inp_1; int inp_2;);
#endif
The following code is the function definition.
//dswapoptlow.c src file
#include "dswapoptlow.h"
struct _return{int a;int b;}; //Init a struct named _return for 2 integer variables.
typedef struct _return _struct;
_struct dswap_opt_low(int inp1, int inp2)
{
_struct _instance;
_instance.a=inp1;
_instance.b=inp2;
_instance.a=_instance.a+_instance.b;
_instance.b=_instance.a-_instance.b;
_instance.a=_instance.a-_instance.b;
return _instance;
}

struct dswap_opt_low(int inp_1; int inp_2;);supposed to be a function declaration, or a variable definition? It's neither.dsawp_opt_low(int inp_1, int inp_2);legal?struct dswap_opt_low(int inp_1; int inp_2;);and this_struct dswap_opt_low(int inp_1, int inp_2;);is not the same.