storing data on a buffer on c++

450 views Asked by At

I have a simple function on c++ which takes 2 arguments:

read(uint32_t *buffer, uint32_t num_words){
    ...
}

When I try to call it I get an error because the arguments I pass are probably wrong unsigned long*, unsigned long:

uint32_t addr = 5;
uint32_t buf[5];
read(buf,addr);

I'm not sure why this is wrong. Any ideas?

1

There are 1 answers

0
user891558 On

The problem might be because the compiler is not able to convert pointer to const pointer(that is array variable). Change the prototype of of read to read(uint32_t buffer [], uint32_t num_words).. This will work.