Click here to Skip to main content
15,921,941 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: pointer casting Pin
CPallini9-Apr-09 0:45
mveCPallini9-Apr-09 0:45 
GeneralRe: pointer casting Pin
Rajesh R Subramanian9-Apr-09 1:19
professionalRajesh R Subramanian9-Apr-09 1:19 
GeneralRe: pointer casting Pin
CPallini9-Apr-09 1:55
mveCPallini9-Apr-09 1:55 
GeneralRe: pointer casting Pin
Rajesh R Subramanian9-Apr-09 2:09
professionalRajesh R Subramanian9-Apr-09 2:09 
GeneralRe: pointer casting Pin
Jorge9-Apr-09 1:37
Jorge9-Apr-09 1:37 
AnswerRe: pointer casting Pin
Rajesh R Subramanian9-Apr-09 0:38
professionalRajesh R Subramanian9-Apr-09 0:38 
GeneralRe: pointer casting Pin
Jorge9-Apr-09 1:08
Jorge9-Apr-09 1:08 
GeneralRe: pointer casting Pin
Rajesh R Subramanian9-Apr-09 1:13
professionalRajesh R Subramanian9-Apr-09 1:13 
Have a closer look:

1. nArray is a an array of integers - the elements stored in the array are of 'int' data type.
2. You create a pointer variable, which actually is supposed to point to a double, but you made it (you wanted that) to point to the beginning address of the integer array.
3. Now, it's just that the pointer type is double, but is pointing to an int array. You still have not converted the individual int elements in the array to double type.
4. If that's what you want, you can try %g in place of %d in the CString::Format() statement and see the results. (this way, you are just 'interpreting' an integer as a double, and you haven't converted any of the array elements from one datatype to another)

But please remember that the elements in the array are *still* int ones and if you want every element of the array to be of double data type, you must do the conversion yourself for every element of the array. Changing a pointer won't do that, quite obviously.

Am I clear enough?


It is a crappy thing, but it's life -^ Carlo Pallini

GeneralRe: pointer casting Pin
Jorge9-Apr-09 1:40
Jorge9-Apr-09 1:40 
AnswerRe: pointer casting Pin
Divyang Mithaiwala9-Apr-09 1:01
Divyang Mithaiwala9-Apr-09 1:01 
GeneralRe: pointer casting Pin
Jorge9-Apr-09 1:19
Jorge9-Apr-09 1:19 
QuestionHeader file Pin
p_19608-Apr-09 21:25
p_19608-Apr-09 21:25 
AnswerRe: Header file Pin
«_Superman_»8-Apr-09 21:29
professional«_Superman_»8-Apr-09 21:29 
AnswerRe: Header file Pin
CPallini8-Apr-09 21:31
mveCPallini8-Apr-09 21:31 
AnswerRe: Header file Pin
ThatsAlok8-Apr-09 22:38
ThatsAlok8-Apr-09 22:38 
GeneralRe: Header file Pin
CPallini8-Apr-09 22:42
mveCPallini8-Apr-09 22:42 
AnswerRe: Header file Pin
Hamid_RT8-Apr-09 23:52
Hamid_RT8-Apr-09 23:52 
QuestionShellExecuteEx not working fine in case of Visual Studio 2008. Pin
Le@rner8-Apr-09 21:03
Le@rner8-Apr-09 21:03 
AnswerRe: ShellExecuteEx not working fine in case of Visual Studio 2008. Pin
Rajesh R Subramanian8-Apr-09 21:37
professionalRajesh R Subramanian8-Apr-09 21:37 
JokeRe: ShellExecuteEx not working fine in case of Visual Studio 2008. Pin
CPallini8-Apr-09 22:01
mveCPallini8-Apr-09 22:01 
JokeRe: ShellExecuteEx not working fine in case of Visual Studio 2008. Pin
Rajesh R Subramanian8-Apr-09 22:20
professionalRajesh R Subramanian8-Apr-09 22:20 
AnswerRe: ShellExecuteEx not working fine in case of Visual Studio 2008. Pin
Hamid_RT8-Apr-09 23:56
Hamid_RT8-Apr-09 23:56 
QuestionBasic Segmentation fault help needed Pin
Brandon Ramirez8-Apr-09 20:56
Brandon Ramirez8-Apr-09 20:56 
QuestionRe: Basic Segmentation fault help needed Pin
CPallini8-Apr-09 21:27
mveCPallini8-Apr-09 21:27 
QuestionRe: Basic Segmentation fault help needed Pin
Brandon Ramirez8-Apr-09 21:46
Brandon Ramirez8-Apr-09 21:46 

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.