Static variables and functions problem in a class

This is a discussion on Static variables and functions problem in a class within the C++ Programming forums, part of the General Programming Boards category; In the while loop before that I check for k not to exceed 14 or 8. But I redundantly input ...

  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].

Page 2 of 2 FirstFirst 12
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, 02: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, 06:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21