Click here to Skip to main content
16,005,467 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralImport Libraries?? (Damn Newbie) Pin
9-Aug-01 11:08
suss9-Aug-01 11:08 
GeneralRe: Import Libraries?? (Damn Newbie) Pin
Malcolm McMahon9-Aug-01 22:06
Malcolm McMahon9-Aug-01 22:06 
GeneralUnresolved externals - Ugh! Pin
Bret Faller9-Aug-01 7:35
Bret Faller9-Aug-01 7:35 
GeneralRe: Unresolved externals - Ugh! Pin
J Patel9-Aug-01 10:27
J Patel9-Aug-01 10:27 
GeneralRe: Unresolved externals - Ugh! Pin
Bret Faller9-Aug-01 10:38
Bret Faller9-Aug-01 10:38 
GeneralRe: Unresolved externals - Ugh! Pin
15-Oct-01 8:07
suss15-Oct-01 8:07 
GeneralRe: Unresolved externals - Ugh! Pin
15-Oct-01 8:42
suss15-Oct-01 8:42 
Generalsize and a passed pointer Pin
9-Aug-01 7:02
suss9-Aug-01 7:02 
Hello all,

I am a new C++ programmer, and have run into a behavior that I don't understand. Consider the following code:


#include <iostream>
using namespace std;


int aArray[] = {20, 30, 40, 50, 60, 70}; // Create a test array

int myFunc(int *ara); // Func Prototype


void main(void)
{
myFunc(aArray);
return;
}


int myFunc(int *ara)
{
cout << endl << "Address of aArray: " << aArray;
// Returns a memory address.

cout << endl << "Size of aArray: " << (sizeof aArray);
// Returns 24, as expected.

cout << endl << "Address of ara: " << ara;
//Returns same address as aArray, above.

cout << endl << "Size of ara: " << (sizeof ara);
// !! Returns 4. Why is this?
// Does sizeof not work with a pointer passed to a function?

cout << endl;
return 0;
}

In all of the "Beginning C++" manuals I have looked at, the examples show passing the size of the array as an additional parameter to the function. This does address the issue I am dealing with here, but it seems more elegant to be able to interogate the array size **inside** the function. Can someone shed some light on this, please?


Thanks in advance,
GeneralRe: size and a passed pointer Pin
User 98859-Aug-01 7:08
User 98859-Aug-01 7:08 
GeneralRe: size and a passed pointer Pin
Bret Faller9-Aug-01 8:21
Bret Faller9-Aug-01 8:21 
GeneralForcing a range validation of an edit box before a scrollbar command is activated Pin
brewer_d9-Aug-01 6:09
brewer_d9-Aug-01 6:09 
GeneralCComboBox Messages Pin
Michael Martin9-Aug-01 5:49
professionalMichael Martin9-Aug-01 5:49 
GeneralRe: CComboBox Messages Pin
Carlos Antollini9-Aug-01 6:06
Carlos Antollini9-Aug-01 6:06 
GeneralRe: CComboBox Messages Pin
Michael Martin9-Aug-01 6:16
professionalMichael Martin9-Aug-01 6:16 
GeneralRe: CComboBox Messages Pin
Carlos Antollini9-Aug-01 6:30
Carlos Antollini9-Aug-01 6:30 
GeneralRe: CComboBox Messages Pin
Michael Martin9-Aug-01 6:34
professionalMichael Martin9-Aug-01 6:34 
GeneralRe: CComboBox Messages Pin
Tomasz Sowinski9-Aug-01 6:28
Tomasz Sowinski9-Aug-01 6:28 
GeneralRe: CComboBox Messages Pin
Michael Martin9-Aug-01 6:47
professionalMichael Martin9-Aug-01 6:47 
Generalin vc6.0 and mfc4.2 's link.exe 's error Pin
9-Aug-01 5:29
suss9-Aug-01 5:29 
GeneralRe: in vc6.0 and mfc4.2 's link.exe 's error Pin
Ben Burnett9-Aug-01 9:24
Ben Burnett9-Aug-01 9:24 
GeneralRecording keystrock international issue Pin
9-Aug-01 5:21
suss9-Aug-01 5:21 
QuestionDrawing ActiveX ctrls into memory? Pin
9-Aug-01 5:14
suss9-Aug-01 5:14 
GeneralHelp! Checkboxes in CListCtrl's Pin
Sprudling9-Aug-01 4:33
Sprudling9-Aug-01 4:33 
GeneralRe: Help! Checkboxes in CListCtrl's Pin
Tomasz Sowinski9-Aug-01 4:43
Tomasz Sowinski9-Aug-01 4:43 
GeneralRe: Help! Checkboxes in CListCtrl's Pin
Sprudling9-Aug-01 5:32
Sprudling9-Aug-01 5:32 

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.