+ Reply to Thread
Results 1 to 3 of 3

Thread: How to sort C array using STL algorithm?

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    46

    How to sort C array using STL algorithm?

    How to sort C array using STL algorithm?

    Can I do this?

  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    38
    Use following code:

    Code:
    void SortArray()
    {
    	int aItems[10] ;
    
    	for (int nIndex=0; nIndex<10; nIndex++)
    	{
    		aItems[nIndex] = nIndex;
    	}
    
    	aItems[0] = 99 ;
    
    	aItems[5] = 23 ;
    
    
    	std::sort(&aItems[0], &aItems[10]) ;
    }

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Posts
    46
    Thanks. It worked.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

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