Click here to Skip to main content
15,905,148 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dialog size should change to the system screen size Pin
chikach17-May-10 7:07
chikach17-May-10 7:07 
AnswerRe: Dialog size should change to the system screen size Pin
Xeqtr18-May-10 10:43
Xeqtr18-May-10 10:43 
GeneralRe: Dialog size should change to the system screen size Pin
chikach19-May-10 14:34
chikach19-May-10 14:34 
GeneralRe: Dialog size should change to the system screen size Pin
chikach19-May-10 14:38
chikach19-May-10 14:38 
AnswerRe: Dialog size should change to the system screen size Pin
Gary R. Wheeler15-May-10 2:00
Gary R. Wheeler15-May-10 2:00 
GeneralRe: Dialog size should change to the system screen size Pin
loyal ginger15-May-10 10:53
loyal ginger15-May-10 10:53 
AnswerRe: Dialog size should change to the system screen size Pin
zp200015-May-10 18:49
zp200015-May-10 18:49 
AnswerRe: Dialog size should change to the system screen size Pin
Xeqtr16-May-10 7:40
Xeqtr16-May-10 7:40 
GeneralRe: Dialog size should change to the system screen size Pin
chikach20-May-10 5:30
chikach20-May-10 5:30 
AnswerRe: Dialog size should change to the system screen size Pin
Xeqtr20-May-10 6:42
Xeqtr20-May-10 6:42 
QuestionUnmanaged C++ DLLs with Unicode via ASP or ASP.NET Pin
Toadlips14-May-10 12:27
Toadlips14-May-10 12:27 
AnswerRe: Unmanaged C++ DLLs with Unicode via ASP or ASP.NET Pin
Gary R. Wheeler15-May-10 2:02
Gary R. Wheeler15-May-10 2:02 
GeneralRe: Unmanaged C++ DLLs with Unicode via ASP or ASP.NET Pin
Toadlips17-May-10 3:49
Toadlips17-May-10 3:49 
QuestionOne-time initialization of an ActiveX control in CFormView-derived class Pin
sashoalm14-May-10 5:48
sashoalm14-May-10 5:48 
AnswerRe: One-time initialization of an ActiveX control in CFormView-derived class Pin
«_Superman_»14-May-10 6:35
professional«_Superman_»14-May-10 6:35 
QuestionHow to return 2-dimension array in a function Pin
akira3214-May-10 5:48
akira3214-May-10 5:48 
AnswerRe: How to return 2-dimension array in a function Pin
CPallini14-May-10 6:30
mveCPallini14-May-10 6:30 
AnswerRe: How to return 2-dimension array in a function [modified] Pin
Aescleal14-May-10 11:48
Aescleal14-May-10 11:48 
akira32 wrote:
In getA, I can get 1-dimension array.


The first thing here is that you're not "get[ing] 1-dimension array." you're returning the address of the first element of where a 1 dimensional array was before the function returned. Depending on what you do with the pointer after the function returns you could crash your program or even leave it with a big security hole.

The bad news is that you can't return an array of any sort directly from a function. The slightly better news is that you can return a structure containing an array, e.g:

struct array_wrapper
{
    int data[10];
};

struct array_wrapper get_array()
{
    struct array_wrapper a;
    a.data[5] = 100;
    return a;
}


Quick caveat: I don't program in C anymore so I may have got the syntax a bit wrong.

Cheers,

Ash

Edited to fix slightly knackered code formatting

modified on Friday, May 14, 2010 5:54 PM

AnswerRe: How to return 2-dimension array in a function Pin
Richard MacCutchan14-May-10 21:32
mveRichard MacCutchan14-May-10 21:32 
GeneralRe: How to return 2-dimension array in a function Pin
Aescleal15-May-10 7:22
Aescleal15-May-10 7:22 
AnswerRe: How to return 2-dimension array in a function Pin
sashoalm15-May-10 2:25
sashoalm15-May-10 2:25 
GeneralRe: How to return 2-dimension array in a function Pin
akira3218-May-10 6:06
akira3218-May-10 6:06 
QuestionVirtual keyboard API or code that runs on WinXP and/or Vista? Pin
KellyR14-May-10 3:49
KellyR14-May-10 3:49 
QuestionProblem with writeprivateprofilestring() Pin
Shivanand Gupta14-May-10 3:29
Shivanand Gupta14-May-10 3:29 
QuestionRe: Problem with writeprivateprofilestring() Pin
David Crow14-May-10 7:58
David Crow14-May-10 7:58 

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.