Q
quek
Im having a problem passing a struct ptr.
Maybe someone could help me.
Heres what Visual C gives me as error:
error C2664: 'adpcm_coder_u' : cannot convert parameter 4 from 'struct
main::$S1 *' to 'struct adpcm_state *'
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
Here is the code
struct adpcm_state {
short valprev; /* Previous output value */
char index; /* Index into stepsize table */
};
extern void adpcm_coder_u(unsigned char[], char[], int, struct
adpcm_state *);
extern void adpcm_decoder_u(char[], unsigned char[], int, struct
adpcm_state *);
void main (void)
{
int i;
int inputArray[20];
unsigned char aLawArray[20];
char adpcmArray[20];
struct *state;
for(i = 0; i<20; i++)
{
inputArray = 20 * (i + 10);
}
for (i=0; i<20; i++)
{
aLawArray = linear2alaw(inputArray);
}
adpcm_coder_u(aLawArray, adpcmArray, 20, state);
for(i=0;i<20;i++){
printf("%d Linear = %d aLaw = %d adpcm
%d",i,inputArray,aLawArray,adpcmArray);
}
}
Thank you guys!
Maybe someone could help me.
Heres what Visual C gives me as error:
error C2664: 'adpcm_coder_u' : cannot convert parameter 4 from 'struct
main::$S1 *' to 'struct adpcm_state *'
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
Here is the code
struct adpcm_state {
short valprev; /* Previous output value */
char index; /* Index into stepsize table */
};
extern void adpcm_coder_u(unsigned char[], char[], int, struct
adpcm_state *);
extern void adpcm_decoder_u(char[], unsigned char[], int, struct
adpcm_state *);
void main (void)
{
int i;
int inputArray[20];
unsigned char aLawArray[20];
char adpcmArray[20];
struct *state;
for(i = 0; i<20; i++)
{
inputArray = 20 * (i + 10);
}
for (i=0; i<20; i++)
{
aLawArray = linear2alaw(inputArray);
}
adpcm_coder_u(aLawArray, adpcmArray, 20, state);
for(i=0;i<20;i++){
printf("%d Linear = %d aLaw = %d adpcm
%d",i,inputArray,aLawArray,adpcmArray);
}
}
Thank you guys!