Thread: Static variables and functions problem in a class

  1. #16
    Registered User
    Join Date
    May 2005
    Location
    Toronto, Canada
    Posts
    257
    In the while loop before that I check for k not to exceed 14 or 8. But I redundantly input an if statement just to make sure. Thanks.
    Everything is relative...

  2. #17
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >In the while loop before that I check for k not to exceed 14 or 8.
    That's the problem.
    Code:
    		char temp[8];
    
    		while(i<indexn && k<8)
    		{
    			temp[k] = rfname[i];
    			k++; i++;
    			
    		}
    
    		temp[k] = '\0';
    Assume k is 8 after the loop. So
    Code:
    		temp[8] = '\0';
    But there is no temp[8].

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Static member functions more efficient?
    By drrngrvy in forum C++ Programming
    Replies: 6
    Last Post: 06-16-2006, 07:07 AM
  2. Functions in class and class variables.
    By Karakus in forum C++ Programming
    Replies: 4
    Last Post: 01-15-2006, 03:29 AM
  3. Question about Static variables and functions.
    By RealityFusion in forum C++ Programming
    Replies: 2
    Last Post: 10-14-2005, 02:31 PM
  4. Using private class members in static functions
    By sethjackson in forum C++ Programming
    Replies: 2
    Last Post: 09-23-2005, 09:54 AM
  5. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM