Click here to Skip to main content
15,902,112 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGain SuperCapture of the mouse? Pin
DaFrawg15-Sep-04 8:40
DaFrawg15-Sep-04 8:40 
GeneralUsing pointers with an array Pin
Anonymous15-Sep-04 7:52
Anonymous15-Sep-04 7:52 
GeneralRe: Using pointers with an array Pin
Chris Losinger15-Sep-04 8:07
professionalChris Losinger15-Sep-04 8:07 
GeneralRe: Using pointers with an array Pin
Dawners15-Sep-04 9:18
sussDawners15-Sep-04 9:18 
GeneralRe: Using pointers with an array Pin
Chris Losinger15-Sep-04 9:25
professionalChris Losinger15-Sep-04 9:25 
GeneralRe: Using pointers with an array Pin
Dawners15-Sep-04 9:32
sussDawners15-Sep-04 9:32 
GeneralRe: Using pointers with an array Pin
David Crow15-Sep-04 9:28
David Crow15-Sep-04 9:28 
GeneralRe: Using pointers with an array Pin
Dawners15-Sep-04 10:03
sussDawners15-Sep-04 10:03 
When I wrote this little program below, I didn't even define the value of size, and it executes with the desired results. I get one print out of the array, and the second time the print function executes the list is sorted. When I try to employ this same logic using pointers, the sort loop only makes one iteration:

#include <iostream>
using namespace std;

void Print (int [], int);
void Sort (int [], int);

void main()

{
const int max =10;
int list [max] = {7, 4, 9, 1, 8,
3, 6, 5, 0, 2};
Print (list,max);
Sort (list, max);
Print (list, max);
}
void Print (int array [], int size)
{
for (int i=0; i<size; i++)
cout="" <<="" array="" [i]="" "="" ";
cout="" endl;
}

void="" sort="" (int="" [],="" int="" size)
{
for="" i="size-1;i">0;--i)
for (int j=0; j<i; ++j)
if="" (array="" [j]=""> array [j+1])
{
int temp = array[j];
array[j] = array[j+1];
array[j+1] = temp;
}
}

This programs works beautifully.Confused | :confused:
GeneralRe: Using pointers with an array Pin
David Crow15-Sep-04 10:54
David Crow15-Sep-04 10:54 
GeneralRe: Using pointers with an array Pin
David Crow24-Sep-04 6:14
David Crow24-Sep-04 6:14 
GeneralRe: Using pointers with an array Pin
Bob Stanneveld15-Sep-04 10:20
Bob Stanneveld15-Sep-04 10:20 
GeneralRe: Using pointers with an array Pin
Tom Wright15-Sep-04 12:25
Tom Wright15-Sep-04 12:25 
GeneralRe: Using pointers with an array Pin
Antony M Kancidrowski16-Sep-04 2:22
Antony M Kancidrowski16-Sep-04 2:22 
GeneralRe: Using pointers with an array Pin
Bob Stanneveld16-Sep-04 4:33
Bob Stanneveld16-Sep-04 4:33 
GeneralRe: Using pointers with an array Pin
SandeepN15-Sep-04 15:14
SandeepN15-Sep-04 15:14 
GeneralRe: Using pointers with an array Pin
Muhammad Azam15-Sep-04 23:41
Muhammad Azam15-Sep-04 23:41 
GeneralCreating a Bitmap On The Fly Pin
#realJSOP15-Sep-04 6:44
professional#realJSOP15-Sep-04 6:44 
GeneralRe: Creating a Bitmap On The Fly Pin
Michael Dunn15-Sep-04 9:24
sitebuilderMichael Dunn15-Sep-04 9:24 
GeneralTransparent Check Box in Dialog Pin
LukeV15-Sep-04 6:36
LukeV15-Sep-04 6:36 
GeneralHyperLink without mfc Pin
Paolo Ponzano15-Sep-04 6:06
Paolo Ponzano15-Sep-04 6:06 
GeneralRe: HyperLink without mfc Pin
Michael Dunn15-Sep-04 9:26
sitebuilderMichael Dunn15-Sep-04 9:26 
GeneralRe: HyperLink without mfc Pin
Paolo Ponzano15-Sep-04 20:51
Paolo Ponzano15-Sep-04 20:51 
GeneralRe: HyperLink without mfc Pin
Michael Dunn16-Sep-04 9:41
sitebuilderMichael Dunn16-Sep-04 9:41 
QuestionGetAdaptersAddresses IPv6 Where the problem is ?? Pin
Alpha Siera15-Sep-04 5:30
Alpha Siera15-Sep-04 5:30 
AnswerRe: GetAdaptersAddresses IPv6 Where the problem is ?? Pin
David Crow15-Sep-04 5:43
David Crow15-Sep-04 5:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.