c - Expected constant expression -


we have snippet of c codes below. solution cause of have been declared , initialize

void fillprocess(void *unused, uint8 *stream, int len) {     uint8 *waveptr;     int waveleft=0;      waveptr = wave.sound + wave.soundpos;     waveleft = wave.soundlen - wave.soundpos;     while ( waveleft <= len ) {     /* process samples */     uint8 process_buf[waveleft];     sdl_memcpy(process_buf, waveptr, waveleft);     /* processing here, e.g. */     /* processing audio samples in process_buf[*] */     // play processed audio samples     sdl_memcpy(stream, process_buf, waveleft);     stream += waveleft;     len -= waveleft;     // ready repeat play audio     waveptr = wave.sound;     waveleft = wave.soundlen;     wave.soundpos = 0;     } } 

getting 3 errors below

error   1   error c2057: expected constant expression    error   2   error c2466: cannot allocate array of constant size 0     error   3   error c2133: 'process_buf' : unknown size 

uint8 process_buf[waveleft]; 

this line uses variable length array, introduced in c99. according error code, using visual studio, doesn't support c99 yet.

assuming compiler still visual studio, can allocate process_buf dynamically.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -