Click here to Skip to main content
15,888,351 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: Modularizing Help Pin
@Intersect☺™17-Nov-10 11:06
professional@Intersect☺™17-Nov-10 11:06 
GeneralRe: Modularizing Help Pin
Aaronov17-Nov-10 11:17
Aaronov17-Nov-10 11:17 
QuestionCList inside a CMap Pin
kasi1420-Oct-10 8:51
kasi1420-Oct-10 8:51 
AnswerRe: CList inside a CMap Pin
Richard MacCutchan20-Oct-10 21:58
mveRichard MacCutchan20-Oct-10 21:58 
AnswerRe: CList inside a CMap Pin
Cool_Dev21-Oct-10 0:15
Cool_Dev21-Oct-10 0:15 
Questionvector<string> and find Pin
Jonnster20-Oct-10 3:33
Jonnster20-Oct-10 3:33 
AnswerRe: vector and find [modified] PinPopular
Alain Rist20-Oct-10 5:04
Alain Rist20-Oct-10 5:04 
Questionhow to allocate memory dynamically for 2 dimensional array and use that pointer like and array.... Pin
cmaheshwari1619-Oct-10 18:40
cmaheshwari1619-Oct-10 18:40 
Hi All,

I want to declare memory dynamically for a 2 dimensional array.
and then want to use that pointer like an array.

as i am using ANSI compiler so there is no need to typecast the return type of the memory block returned by malloc()
so if i will write the inline code line as arr=malloc (nrows*5*sizeof(int)); its working correctly but i just want to know to be at the safer side that if i will be using the old compiler how to type cast the same as arr=(int [] *)(malloc (nrows*5*sizeof(int))); this is giving error.(i am on linux)

thanks


#include<stdio.h>
#include<stdlib.h>
int main()
{
int nrows=2,i,j;
//int arr[nrows][5];
int (*arr)[5];
<code>arr=(int [] *)(malloc (nrows*5*sizeof(int)));</code>
for(i=0;i<nrows;i++)
for (j=0;j<5;j++)
//*(*(arr+i)+j)=17;
arr[i][j]=17;

for(i=0;i<nrows;i++)
for (j=0;j<5;j++)
printf("\n%d",arr[i][j]);
}

AnswerRe: how to allocate memory dynamically for 2 dimensional array and use that pointer like and array.... Pin
Stuart Dootson20-Oct-10 1:11
professionalStuart Dootson20-Oct-10 1:11 
Questionabout pthread.h Pin
lxlenovostar18-Oct-10 5:36
lxlenovostar18-Oct-10 5:36 
AnswerRe: about pthread.h Pin
Richard MacCutchan18-Oct-10 9:28
mveRichard MacCutchan18-Oct-10 9:28 
GeneralRe: about pthread.h Pin
lxlenovostar18-Oct-10 15:59
lxlenovostar18-Oct-10 15:59 
GeneralRe: about pthread.h Pin
Richard MacCutchan18-Oct-10 22:27
mveRichard MacCutchan18-Oct-10 22:27 
GeneralRe: about pthread.h Pin
lxlenovostar18-Oct-10 23:13
lxlenovostar18-Oct-10 23:13 
GeneralRe: about pthread.h Pin
Richard MacCutchan19-Oct-10 0:26
mveRichard MacCutchan19-Oct-10 0:26 
Questionproblem Pin
samosato12-Oct-10 9:57
samosato12-Oct-10 9:57 
AnswerRe: problem Pin
Nuri Ismail12-Oct-10 21:55
Nuri Ismail12-Oct-10 21:55 
AnswerRe: problem Pin
Richard MacCutchan12-Oct-10 22:38
mveRichard MacCutchan12-Oct-10 22:38 
AnswerRe: problem [modified] Pin
Alain Rist13-Oct-10 4:52
Alain Rist13-Oct-10 4:52 
QuestionFire connection point event from ATL Service Pin
pratik_mishra3511-Oct-10 2:17
pratik_mishra3511-Oct-10 2:17 
Questionhow show the tooltip in each platform(vb,c#) Pin
765studio@gmail.com8-Oct-10 20:35
765studio@gmail.com8-Oct-10 20:35 
QuestionProblems to print Pin
Dansveen7-Oct-10 11:42
Dansveen7-Oct-10 11:42 
QuestionWhy normal virtual function required blank body in base class Pin
am 20096-Oct-10 2:22
am 20096-Oct-10 2:22 
AnswerRe: Why normal virtual function required blank body in base class Pin
Alain Rist6-Oct-10 3:13
Alain Rist6-Oct-10 3:13 
QuestionEnable moving marquee progress bar (C++, ATL/WTL, XP, VS2008) Pin
karuuzo5-Oct-10 6:58
karuuzo5-Oct-10 6: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.