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_cas t, 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(u nsigned 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[i] = 20 * (i + 10);
}
for (i=0; i<20; i++)
{
aLawArray[i] = linear2alaw(inp utArray[i]);
}
adpcm_coder_u(a LawArray, adpcmArray, 20, state);
for(i=0;i<20;i+ +){
printf("%d Linear = %d aLaw = %d adpcm
%d",i,inputArra y[i],aLawArray[i],adpcmArray[i]);
}
}
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_cas t, 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(u nsigned 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[i] = 20 * (i + 10);
}
for (i=0; i<20; i++)
{
aLawArray[i] = linear2alaw(inp utArray[i]);
}
adpcm_coder_u(a LawArray, adpcmArray, 20, state);
for(i=0;i<20;i+ +){
printf("%d Linear = %d aLaw = %d adpcm
%d",i,inputArra y[i],aLawArray[i],adpcmArray[i]);
}
}
Thank you guys!
Comment