CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    41

    working with an array that is a float

    /*hi the answer to this is proberly really easy
    i am trying to multiply a bit of data from the array by an integer*/

    float data[40][7] = {
    {1, 20, 1.6, .873, 111, .00608}, /*.....etc*/

    deadload = t*(data[j][3]) + c*(data[i][3]);

    /*i, j, c and t are all integers deadload is a float the program doesn't error but the output is addresses i think*/

  2. #2
    Join Date
    Oct 2005
    Location
    Bangalore
    Posts
    1,051

    Re: data array manipulation

    i am not sure what you are tryin to accomplish...... please give more info...
    by the way why the brackets areoud the array ???? try this
    deadload = (t*data[j][3]) + (c*data[i][3]);
    - Sreehari
    "Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."
    " Everybody is sent to Earth on a purpose. I am so Lagging behind that i won't die." – Calvin

  3. #3
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: working with an array that is a float

    This code is correct. The error must come from somewhere else.
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

  4. #4
    Join Date
    Oct 2005
    Location
    Bangalore
    Posts
    1,051

    Re: working with an array that is a float

    please dont post multiple threads for the same issue ..
    - Sreehari
    "Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."
    " Everybody is sent to Earth on a purpose. I am so Lagging behind that i won't die." – Calvin

  5. #5
    Join Date
    May 2005
    Location
    Oregon
    Posts
    3,725

    Re: data array manipulation

    did u initialize all the variable like i,j etc because by default they are auto and contain garbage value.so u r going to get some garbage value in your result.

    Thanx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured