Click here to Skip to main content
14,698,687 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
zak10026-Apr-19 11:22
Memberzak10026-Apr-19 11:22 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
John R. Shaw26-Apr-19 13:31
MemberJohn R. Shaw26-Apr-19 13:31 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
zak10026-Apr-19 15:57
Memberzak10026-Apr-19 15:57 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
zak10026-Apr-19 18:53
Memberzak10026-Apr-19 18:53 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
John R. Shaw30-Apr-19 5:56
MemberJohn R. Shaw30-Apr-19 5:56 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
zak10030-Apr-19 6:48
Memberzak10030-Apr-19 6:48 
GeneralMessage Closed Pin
30-Apr-19 1:01
Memberpestcontrol130-Apr-19 1:01 
QuestionPointer to Pointer: Conversion from- C++ to C-language Pin
zak10024-Apr-19 19:47
Memberzak10024-Apr-19 19:47 
Hi,
I have following C++ code:
double ** data = NULL;
data = new double*[num_cols];//Is the asterisk required or is an error
for(int i = 0; i < num_cols; i++)
  data[i] = new double[num_rows];


I have converted them into following C-language code:

double ** data = NULL;
data = (double *) malloc(num_cols * sizeof(double));
for(int i = 0; i < num_cols; i++)
   data[i] = (double *) malloc(num_rows * sizeof(double));


I am getting following error message with gcc:
Quote:
In function ‘main’:
gaussian.c:73:8: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
data = (double *) malloc(num_cols * sizeof(double));


Some body please guide me.

Zulfi.
AnswerRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Victor Nijegorodov24-Apr-19 21:41
MemberVictor Nijegorodov24-Apr-19 21:41 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
leon de boer25-Apr-19 3:09
Memberleon de boer25-Apr-19 3:09 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
k505425-Apr-19 8:16
mvek505425-Apr-19 8:16 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Richard MacCutchan24-Apr-19 22:36
mveRichard MacCutchan24-Apr-19 22:36 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
leon de boer25-Apr-19 3:04
Memberleon de boer25-Apr-19 3:04 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Richard MacCutchan25-Apr-19 3:46
mveRichard MacCutchan25-Apr-19 3:46 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
zak10025-Apr-19 7:52
Memberzak10025-Apr-19 7:52 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Joe Woodbury29-Apr-19 7:38
professionalJoe Woodbury29-Apr-19 7:38 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
leon de boer3-May-19 5:20
Memberleon de boer3-May-19 5:20 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Joe Woodbury3-May-19 6:51
professionalJoe Woodbury3-May-19 6:51 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
zak10025-Apr-19 8:05
Memberzak10025-Apr-19 8:05 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
zak10025-Apr-19 8:10
Memberzak10025-Apr-19 8:10 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
leon de boer25-Apr-19 8:49
Memberleon de boer25-Apr-19 8:49 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
zak10025-Apr-19 9:56
Memberzak10025-Apr-19 9:56 
AnswerRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
ChrisFromWales1-May-19 0:37
MemberChrisFromWales1-May-19 0:37 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Stefan_Lang4-Jun-19 23:01
mveStefan_Lang4-Jun-19 23:01 
Questionprocessing Multithread in MFC Pin
Member 1422104124-Apr-19 19:41
MemberMember 1422104124-Apr-19 19:41 

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.