4

Specifically, I'm wondering if this line:

memset(cjzyp,(0,0),size_cjzy*sizeof(std::complex<float>));

will fill cjzyp, an array of complex<float>s, with the complex zero value ((0,0)).

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
  • memset(cjzyp,(0,0),size_cjzy*sizeof(std::complex)); Sorry there seems to be an error with the above line of code where the was omitted. Above is the correct one. – user1843784 Nov 22 '12 at 02:48

1 Answers1

3

std::memset takes as second parameter an int converted to an unsigned char, it won't work. Use std::fill instead

http://www.cplusplus.com/reference/algorithm/fill/

cjzyp = new std::complex<float>[100]
std::fill(cjzyp, cjzyp + 100, std::complex<float>(-1.0, 0.0));
delete [] cjzyp;
Cape Code
  • 3,584
  • 3
  • 24
  • 45
fcatho
  • 317
  • 2
  • 14