Click here to Skip to main content
15,900,906 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ Pin
rowdy_vc++27-Jan-08 18:15
rowdy_vc++27-Jan-08 18:15 
GeneralRe: C++ Pin
Maxwell Chen27-Jan-08 18:21
Maxwell Chen27-Jan-08 18:21 
GeneralRe: C++ Pin
rowdy_vc++27-Jan-08 18:33
rowdy_vc++27-Jan-08 18:33 
GeneralRe: C++ [modified] Pin
Maxwell Chen27-Jan-08 18:36
Maxwell Chen27-Jan-08 18:36 
GeneralRe: C++ Pin
rowdy_vc++27-Jan-08 18:52
rowdy_vc++27-Jan-08 18:52 
GeneralRe: C++ Pin
rowdy_vc++27-Jan-08 19:10
rowdy_vc++27-Jan-08 19:10 
GeneralRe: C++ Pin
rp_suman27-Jan-08 20:43
rp_suman27-Jan-08 20:43 
GeneralRe: C++ Pin
Maxwell Chen27-Jan-08 21:06
Maxwell Chen27-Jan-08 21:06 
rp_suman wrote:
Probably you forget to increment value of "i" before return like i = i + 1;.


Yes I forgot. Sorry! Poke tongue | ;-P


rp_suman wrote:
Why you are having char* argument as you are returning char*?


To return the original address for later use. As:
char* Test(char* str)
{
  static int i = 1;
  sprintf(str, "%d.", i++); // Now I remember to increment it.
  return str;
}
// ...
char sBuf[10] = {0};
int v = 0;
for( ; v < 3; v++) {
  printf(Test(sBuf));
  printf("\n");
}


  Maxwell Chen

GeneralRe: C++ Pin
rp_suman27-Jan-08 21:12
rp_suman27-Jan-08 21:12 
GeneralWorking with two classes Pin
CodingLover27-Jan-08 17:03
CodingLover27-Jan-08 17:03 
GeneralRe: Working with two classes Pin
Nitheesh George27-Jan-08 17:12
Nitheesh George27-Jan-08 17:12 
GeneralRe: Working with two classes Pin
CodingLover27-Jan-08 17:20
CodingLover27-Jan-08 17:20 
GeneralRe: Working with two classes Pin
Nitheesh George27-Jan-08 17:37
Nitheesh George27-Jan-08 17:37 
GeneralRe: Working with two classes Pin
CodingLover27-Jan-08 17:41
CodingLover27-Jan-08 17:41 
GeneralRe: Working with two classes Pin
Nitheesh George27-Jan-08 18:00
Nitheesh George27-Jan-08 18:00 
GeneralRe: Working with two classes Pin
CodingLover27-Jan-08 18:06
CodingLover27-Jan-08 18:06 
GeneralRe: Working with two classes Pin
Nitheesh George27-Jan-08 18:17
Nitheesh George27-Jan-08 18:17 
GeneralRe: Working with two classes Pin
CodingLover27-Jan-08 18:48
CodingLover27-Jan-08 18:48 
GeneralRe: Working with two classes Pin
sheshidar27-Jan-08 17:42
sheshidar27-Jan-08 17:42 
Questionexception from C function? Pin
George_George27-Jan-08 16:11
George_George27-Jan-08 16:11 
AnswerRe: exception from C function? Pin
Maxwell Chen27-Jan-08 18:13
Maxwell Chen27-Jan-08 18:13 
GeneralRe: exception from C function? Pin
George_George27-Jan-08 18:23
George_George27-Jan-08 18:23 
GeneralRe: exception from C function? Pin
Maxwell Chen27-Jan-08 18:57
Maxwell Chen27-Jan-08 18:57 
GeneralRe: exception from C function? Pin
George_George27-Jan-08 19:10
George_George27-Jan-08 19:10 
GeneralRe: exception from C function? Pin
Maxwell Chen27-Jan-08 19:27
Maxwell Chen27-Jan-08 19:27 

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.