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

C / C++ / MFC

 
QuestionLinux? Pin
CPallini31-Mar-07 8:20
mveCPallini31-Mar-07 8:20 
AnswerRe: asking how to program list only hidden files under linux in c Pin
ThatsAlok1-Apr-07 21:18
ThatsAlok1-Apr-07 21:18 
QuestionHTF? :mad: Pin
_808631-Mar-07 6:53
_808631-Mar-07 6:53 
AnswerRe: HTF? :mad: Pin
PJ Arends31-Mar-07 7:20
professionalPJ Arends31-Mar-07 7:20 
GeneralRe: HTF? :mad: [modified] Pin
_808631-Mar-07 7:58
_808631-Mar-07 7:58 
GeneralRe: HTF? :mad: Pin
PJ Arends31-Mar-07 12:07
professionalPJ Arends31-Mar-07 12:07 
GeneralRe: HTF? :mad: Pin
_808631-Mar-07 16:49
_808631-Mar-07 16:49 
GeneralRe: HTF? :mad: Pin
CPallini31-Mar-07 12:08
mveCPallini31-Mar-07 12:08 
Of course the compiler is working fine. Please follow me in code inspection, to make analysis shorter, let's start with fun(2):
fun(2){
  if(2>0){
    fun(1);


At the moment (no output yet produced) we have to stop considering fun(2) and, due to recursion, procede with the inspection of fun(1):

fun(1){
  if(1>0){
    fun(0);


Again (no output yet), we have to suspend considering fun(1) and go deeper in recursion with fun(0):
fun(0){
  if(0>0){


Here, the compiler, that is a honest guy, correctly evaluates (0>0) as false and the function returns. Have we done? No, of course, there are (in the order) fun(1) and fun(2) waiting on the stack. So let's go back to fun(1) and reprise whereever we suspended:
  printf("\n%d",0);
  fun(-1);
}


As you can see, this is the first time we have a number on the console, and the number is 0 (you can also see that fun(-1) is called, but it will do nothing). Of course we could go on with code inspection, but I think it's enough: we have the zero, and we also have the demonstration that the compiler is not insane.

hope that:
(1) the analysis is correct.
(2) it helps.

Smile | :)



If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

GeneralRe: HTF? :mad: Pin
_808631-Mar-07 16:51
_808631-Mar-07 16:51 
QuestionChttpConnection class problem Pin
prithaa31-Mar-07 6:31
prithaa31-Mar-07 6:31 
AnswerRe: ChttpConnection class problem Pin
Mark Salsbery1-Apr-07 7:10
Mark Salsbery1-Apr-07 7:10 
GeneralRe: ChttpConnection class problem Pin
prithaa1-Apr-07 20:09
prithaa1-Apr-07 20:09 
GeneralRe: ChttpConnection class problem Pin
Mark Salsbery2-Apr-07 4:21
Mark Salsbery2-Apr-07 4:21 
GeneralRe: ChttpConnection class problem Pin
prithaa2-Apr-07 19:21
prithaa2-Apr-07 19:21 
GeneralRe: ChttpConnection class problem Pin
Mark Salsbery3-Apr-07 7:09
Mark Salsbery3-Apr-07 7:09 
GeneralRe: ChttpConnection class problem Pin
prithaa4-Apr-07 21:50
prithaa4-Apr-07 21:50 
Questionmemory problem Pin
vasu_sri31-Mar-07 3:01
vasu_sri31-Mar-07 3:01 
AnswerRe: memory problem Pin
CPallini31-Mar-07 5:31
mveCPallini31-Mar-07 5:31 
Questionimapi.h for ICDBurn Pin
scoobydoo200731-Mar-07 2:59
scoobydoo200731-Mar-07 2:59 
AnswerRe: imapi.h for ICDBurn Pin
kanduripavan3-Apr-07 23:00
kanduripavan3-Apr-07 23:00 
Questionis an ip address enough Pin
prithaa31-Mar-07 2:32
prithaa31-Mar-07 2:32 
AnswerRe: is an ip address enough Pin
ThatsAlok1-Apr-07 21:16
ThatsAlok1-Apr-07 21:16 
GeneralRe: is an ip address enough Pin
prithaa1-Apr-07 23:35
prithaa1-Apr-07 23:35 
QuestionTo show calculator Pin
mikobi31-Mar-07 2:04
mikobi31-Mar-07 2:04 
AnswerRe: To show calculator Pin
prasad_som31-Mar-07 2:17
prasad_som31-Mar-07 2:17 

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.