Thread: Help with Array

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    80

    Help with Array

    I'm use to programming in Coldfusion and new to C++, so I'm having a hard time grasping how to get values out of an array:

    The array is named bnext[7][61]

    I need to put the values into a table/query. I understand how to
    grab the 2nd value, but lost on how to get the first part of the array. Here's what I have so far. I put a "?" where I'm confused:

    Code:
    			char bnext[200];
    
    			CString strName = strcat(bnext,"qrybnext");
    	
    		
    			// Create a query object to return to the client
    			CCFXStringSet* pColumns = pRequest->CreateStringSet() ;
    			int iCol1 = pColumns->AddString("MAXDEG") ;
    			int iCol2 = pColumns->AddString("MAXATATM") ;
    
    			CCFXQuery* pQuery = pRequest->AddQuery( strName, pColumns ) ;
    
    			for (i = 0 ; i <= MAXATM + 1 ; i++) {
    			
    				int iRow = pQuery->AddRow() ;
    
    				pQuery->SetData( iRow, iCol1, ? ) ;
    				pQuery->SetData( iRow, iCol2, bnext[i] ) ;
    		
    			}
    Any help would be greatly appreciated

  2. #2
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    well, bnext isn't a 2D array, so I'm not really sure what you are asking, what do you mean by the first part of the array

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    80
    How do you loop through the array and get the value for column 1(the [MAXDEG + 1] see below:

    Code:
    #define MAXATM 60
    #define MAXDEG 6
    
    int bnext[MAXDEG + 1][MAXATM + 1]

  4. #4
    Unregistered User
    Join Date
    Sep 2005
    Location
    Antarctica
    Posts
    341
    bnext[i] will return an array of size MAXATM + 1. So if you want the first item in the MAXDEG array, you would do bnext[i][0].

  5. #5
    Registered User
    Join Date
    Aug 2005
    Posts
    80
    Thanks for your help

    Slowly learning, looking foward to when I can answer some questions

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  2. Replies: 6
    Last Post: 11-09-2006, 03:28 AM
  3. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM