↧
Answer by KC-NH for How to initialize an array of doubles in c++?
memset(a, n*n, n*sizeof(int));This is probably not doing what you expect. The doc says that the value param is converted to an unsigned char. Each byte will be set to that value. When you look at the 4...
View ArticleHow to initialize an array of doubles in c++?
I realized that in c++ I cannot initialize an array of double with memset. For an integer array I can easily initialize the array using:int* a = new int[n];memset(a, n*n, n*sizeof(int));But how can I...
View Article