Click here to Skip to main content
15,892,059 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to declare global variable in MFC dialog based application? Pin
sn00pi23-Oct-08 5:31
sn00pi23-Oct-08 5:31 
GeneralRe: How to declare global variable in MFC dialog based application? Pin
CPallini23-Oct-08 6:06
mveCPallini23-Oct-08 6:06 
GeneralRe: How to declare global variable in MFC dialog based application? Pin
sn00pi23-Oct-08 8:02
sn00pi23-Oct-08 8:02 
GeneralRe: How to declare global variable in MFC dialog based application? Pin
CPallini23-Oct-08 8:06
mveCPallini23-Oct-08 8:06 
Questionstring pointer and int pointer Pin
rahulcrjk23-Oct-08 2:40
rahulcrjk23-Oct-08 2:40 
AnswerRe: string pointer and int pointer Pin
Roger Stoltz23-Oct-08 2:52
Roger Stoltz23-Oct-08 2:52 
AnswerRe: string pointer and int pointer Pin
Cedric Moonen23-Oct-08 2:55
Cedric Moonen23-Oct-08 2:55 
AnswerRe: string pointer and int pointer Pin
CPallini23-Oct-08 3:01
mveCPallini23-Oct-08 3:01 
rahulcrjk wrote:
Herecan say, numptr is a pointer to an integer and it has the address of the location where 5 is stored

good.


rahulcrjk wrote:
char * number = "five is number";

However here is it right to say that the 'number' is a pointer to a char and stores the address of the first character in the string(f). If it is, then why does the statement,

cout<<number;
gives the string itself as the output and not the address where the character 'f' is stored.


Because:
(1) the string layout in memory is
   ADDRESS     VALUE
number          'f'
number +  1     'i'
number +  2     'v'
number +  3     'e'
number +  4     ' '
number +  5     'i'
number +  6     's'
number +  7     ' '
number +  8     'a'
number +  9     ' '
number + 10     'n'
number + 11     'u'
number + 12     'm'
number + 13     'b'
number + 14     'e'
number + 15     'r'
number + 16     '\0'


(2) the extraction operator << knows about (1).


rahulcrjk wrote:
Also what does '&number' mean when 'number' is a pointer.

is the address of the variable who holds the pointer. For instance

int i; // a integer variable
int * p; // a variable who holds the address of a integer variable
int * * pp; // a variable who holds the address of a variable pointing to a integer
int k;

i = 5;
p = &i;
pp = &p;
k = **pp + 2; // what is the value of k?


Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

AnswerRe: string pointer and int pointer Pin
king'ori23-Oct-08 4:03
king'ori23-Oct-08 4:03 
QuestionConfiguration Reload Pin
Soumyadipta23-Oct-08 2:03
Soumyadipta23-Oct-08 2:03 
AnswerRe: Configuration Reload Pin
Roger Stoltz23-Oct-08 2:20
Roger Stoltz23-Oct-08 2:20 
QuestionHow Can I Return Directory to Output? Pin
Member 422782623-Oct-08 0:37
Member 422782623-Oct-08 0:37 
AnswerRe: How Can I Return Directory to Output? Pin
CPallini23-Oct-08 2:24
mveCPallini23-Oct-08 2:24 
QuestionCreating COM by using ATL dll to wrap C++ MFC unmanaged dll Pin
Member 348023223-Oct-08 0:31
Member 348023223-Oct-08 0:31 
AnswerRe: Creating COM by using ATL dll to wrap C++ MFC unmanaged dll Pin
Roger Stoltz23-Oct-08 1:32
Roger Stoltz23-Oct-08 1:32 
GeneralRe: Creating COM by using ATL dll to wrap C++ MFC unmanaged dll Pin
Member 348023223-Oct-08 7:26
Member 348023223-Oct-08 7:26 
Question[Message Deleted] Pin
Pearson_Bee22-Oct-08 23:49
Pearson_Bee22-Oct-08 23:49 
AnswerRe: something about recv() function confuse me Pin
CPallini22-Oct-08 23:58
mveCPallini22-Oct-08 23:58 
GeneralRe: something about recv() function confuse me Pin
Pearson_Bee23-Oct-08 0:19
Pearson_Bee23-Oct-08 0:19 
GeneralRe: something about recv() function confuse me Pin
CPallini23-Oct-08 1:01
mveCPallini23-Oct-08 1:01 
GeneralRe: something about recv() function confuse me Pin
Mark Salsbery23-Oct-08 4:18
Mark Salsbery23-Oct-08 4:18 
RantRe: [Message Deleted] Pin
JudyL_MD23-Oct-08 9:30
JudyL_MD23-Oct-08 9:30 
QuestionPlease Help me !! Pin
Le@rner22-Oct-08 22:10
Le@rner22-Oct-08 22:10 
AnswerRe: Please Help me !! Pin
Roger Stoltz22-Oct-08 22:17
Roger Stoltz22-Oct-08 22:17 
GeneralRe: Please Help me !! Pin
Le@rner22-Oct-08 22:25
Le@rner22-Oct-08 22:25 

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.