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

C / C++ / MFC

 
AnswerRe: Conversion from- C++ to C-language < free(): invalid size > Pin
John R. Shaw26-Apr-19 9:19
MemberJohn R. Shaw26-Apr-19 9:19 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
zak10026-Apr-19 10:22
Memberzak10026-Apr-19 10:22 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
John R. Shaw26-Apr-19 12:31
MemberJohn R. Shaw26-Apr-19 12:31 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
zak10026-Apr-19 14:57
Memberzak10026-Apr-19 14:57 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
zak10026-Apr-19 17:53
Memberzak10026-Apr-19 17:53 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
John R. Shaw30-Apr-19 4:56
MemberJohn R. Shaw30-Apr-19 4:56 
GeneralRe: Conversion from- C++ to C-language < free(): invalid size > Pin
zak10030-Apr-19 5:48
Memberzak10030-Apr-19 5:48 
QuestionPointer to Pointer: Conversion from- C++ to C-language Pin
zak10024-Apr-19 18:47
Memberzak10024-Apr-19 18: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 20:41
MemberVictor Nijegorodov24-Apr-19 20:41 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
leon de boer25-Apr-19 2:09
Memberleon de boer25-Apr-19 2:09 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
k505425-Apr-19 7:16
mvek505425-Apr-19 7:16 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Richard MacCutchan24-Apr-19 21:36
mveRichard MacCutchan24-Apr-19 21:36 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
leon de boer25-Apr-19 2:04
Memberleon de boer25-Apr-19 2:04 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Richard MacCutchan25-Apr-19 2:46
mveRichard MacCutchan25-Apr-19 2:46 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
zak10025-Apr-19 6:52
Memberzak10025-Apr-19 6:52 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Joe Woodbury29-Apr-19 6:38
professionalJoe Woodbury29-Apr-19 6:38 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
leon de boer3-May-19 4:20
Memberleon de boer3-May-19 4:20 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Joe Woodbury3-May-19 5:51
professionalJoe Woodbury3-May-19 5:51 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
zak10025-Apr-19 7:05
Memberzak10025-Apr-19 7:05 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
zak10025-Apr-19 7:10
Memberzak10025-Apr-19 7:10 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
leon de boer25-Apr-19 7:49
Memberleon de boer25-Apr-19 7:49 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
zak10025-Apr-19 8:56
Memberzak10025-Apr-19 8:56 
AnswerRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
ChrisFromWales30-Apr-19 23:37
MemberChrisFromWales30-Apr-19 23:37 
GeneralRe: Pointer to Pointer: Conversion from- C++ to C-language Pin
Stefan_Lang4-Jun-19 22:01
mveStefan_Lang4-Jun-19 22:01 
Questionprocessing Multithread in MFC Pin
Member 1422104124-Apr-19 18:41
MemberMember 1422104124-Apr-19 18: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.