uninitialized local variable

Posted by blitzeus on Stack Overflow See other posts from Stack Overflow or by blitzeus
Published on 2012-10-13T02:59:57Z Indexed on 2012/10/13 3:37 UTC
Read the original article Hit count: 191

Filed under:
|
|
|
|

This code compiles and runs though gives a Microsoft compiler error that I cant fix

warning C4700: uninitialized local variable 'ptr4D' used.

This is in the last line of the code, I think

#include <iostream>
using namespace std;

const int DIM0 = 2, DIM1 = 3, DIM2 = 4, DIM3 = 5;

void TestDeclar();

int main(){
    TestDeclar();
    cout << "Done!\n";
    return 0;
}

void TestDeclar(){        
    //24 - array of 5 floats
    float xa[DIM3], xb[DIM3], xc[DIM3], xd[DIM3], xe[DIM3], xf[DIM3];
    float xg[DIM3], xh[DIM3], xi[DIM3], xj[DIM3], xk[DIM3], xl[DIM3];   
    float xm[DIM3], xn[DIM3], xo[DIM3], xp[DIM3], xq[DIM3], xr[DIM3];
    float xs[DIM3], xt[DIM3], xu[DIM3], xv[DIM3], xw[DIM3], xx[DIM3];

    //6  - array of 4 pointers to floats
    float *ya[DIM2] = {xa, xb, xc, xd}, *yb[DIM2] = {xe, xf, xg, xh};   
    float *yc[DIM2] = {xi, xj, xk, xl}, *yd[DIM2] = {xm, xn, xo, xp};
    float *ye[DIM2] = {xq, xr, xs, xt}, *yf[DIM2] = {xu, xv, xw, xx};

    //2 - array of 3 pointers to pointers of floats
    float **za[DIM1] = {ya, yb, yc};    
    float **zb[DIM1] = {yd, ye, yf};

    //array of 2 pointers to pointers to pointers of floats
    float ***ptr4D[DIM0] = {za, zb};   
    cout << &***ptr4D[DIM0] << '\n';  
}

© Stack Overflow or respective owner

Related posts about c++

Related posts about variables