Click here to Skip to main content
16,007,126 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalcstring Pin
pnpfriend29-Aug-02 10:50
pnpfriend29-Aug-02 10:50 
GeneralRe: cstring Pin
Tomasz Sowinski29-Aug-02 10:54
Tomasz Sowinski29-Aug-02 10:54 
GeneralRe: cstring Pin
Joaquín M López Muñoz29-Aug-02 11:02
Joaquín M López Muñoz29-Aug-02 11:02 
GeneralRe: cstring Pin
Anonymous29-Aug-02 11:07
Anonymous29-Aug-02 11:07 
GeneralRe: cstring Pin
Chris Losinger29-Aug-02 11:07
professionalChris Losinger29-Aug-02 11:07 
GeneralRe: cstring Pin
Waleed Eissa29-Aug-02 11:18
Waleed Eissa29-Aug-02 11:18 
GeneralRe: cstring Pin
pnpfriend30-Aug-02 3:34
pnpfriend30-Aug-02 3:34 
GeneralArray of Pointers to Strings Pin
Waleed Eissa29-Aug-02 10:40
Waleed Eissa29-Aug-02 10:40 
I'm trying to define an array of pointers to strings, as follows:

char* pArray[5];

pArray = "text1";
(pArray+1) = "text1";
(pArray+2) = "text1";
(pArray+3) = "text1";
(pArray+4) = "text1";

Or even like this:

char* pArray[5];

char* pVar1 = "text1";
char* pVar2 = "text1";
char* pVar3 = "text1";
char* pVar4 = "text1";
char* pVar5 = "text1";

(pArray) = pVar1;
(pArray+1) = pVar2;
(pArray+2) = pVar3;
(pArray+3) = pVar4;
(pArray+4) = pVar5;


But there is something wrong in my code (I know that there is something wrong but I've never done this before), could you please show me the correct way to do it? I to do this without using the new operator because I want to allocate the memory from the stack not from the heap.

P.S. I'm not so good at using pointers in C++ or C, so please excuse my bad coding.

Thanks



(a.k.a. Wal2k)
www.wal2k.com

GeneralRe: Array of Pointers to Strings Pin
Chris Losinger29-Aug-02 10:42
professionalChris Losinger29-Aug-02 10:42 
GeneralRe: Array of Pointers to Strings Pin
Waleed Eissa29-Aug-02 11:13
Waleed Eissa29-Aug-02 11:13 
GeneralRe: Array of Pointers to Strings Pin
Chris Losinger29-Aug-02 11:26
professionalChris Losinger29-Aug-02 11:26 
GeneralRe: Array of Pointers to Strings Pin
Todd Smith29-Aug-02 13:26
Todd Smith29-Aug-02 13:26 
GeneralRe: Array of Pointers to Strings Pin
Brian Delahunty29-Aug-02 10:46
Brian Delahunty29-Aug-02 10:46 
GeneralRe: Array of Pointers to Strings Pin
Waleed Eissa29-Aug-02 11:11
Waleed Eissa29-Aug-02 11:11 
GeneralRe: Array of Pointers to Strings Pin
Prashant Panigrahi.29-Aug-02 11:11
sussPrashant Panigrahi.29-Aug-02 11:11 
GeneralRe: Array of Pointers to Strings Pin
Joaquín M López Muñoz29-Aug-02 11:21
Joaquín M López Muñoz29-Aug-02 11:21 
GeneralRe: Array of Pointers to Strings Pin
Null_Vector29-Aug-02 11:20
Null_Vector29-Aug-02 11:20 
GeneralRe: Array of Pointers to Strings Pin
Michael Dunn29-Aug-02 12:01
sitebuilderMichael Dunn29-Aug-02 12:01 
GeneralEdit control -- detecting when no more text can be entered Pin
Anonymous29-Aug-02 10:38
Anonymous29-Aug-02 10:38 
GeneralRe: Edit control -- detecting when no more text can be entered Pin
Tomasz Sowinski29-Aug-02 10:52
Tomasz Sowinski29-Aug-02 10:52 
GeneralRe: Edit control -- detecting when no more text can be entered Pin
Anonymous29-Aug-02 10:57
Anonymous29-Aug-02 10:57 
GeneralWierd Letter Pin
Nick Parker29-Aug-02 9:39
protectorNick Parker29-Aug-02 9:39 
GeneralRe: Wierd Letter Pin
Joel Holdsworth29-Aug-02 9:57
Joel Holdsworth29-Aug-02 9:57 
GeneralRe: Wierd Letter Pin
Tomasz Sowinski29-Aug-02 10:06
Tomasz Sowinski29-Aug-02 10:06 
GeneralRe: Listview problems!!! AAAAAAAaaaaaaaaa Pin
Ray Cassick29-Aug-02 9:26
Ray Cassick29-Aug-02 9:26 

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.