bna-linuxiran
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [linuxiran] [OT] C programming, variable size array


From: Aryan Ameri
Subject: Re: [linuxiran] [OT] C programming, variable size array
Date: Fri, 12 Dec 2003 23:21:23 +0200
User-agent: KMail/1.5.3

On Friday 12 December 2003 22:44, Arash Partow wrote:
> Hi Aryan,
>
> I went through your code, I've made some modifications etc.
> have a look at the flow of the program. I think from that you
> will see how its done.


WOW! Did you just wrote this? Wow! I takes me two hours to write such a 
code (assuming that I knew how to write it in the first place). 

Anyway, clear, fully commented code. Everything is pretty clear, aside 
from me not knowing malloc and realoc (which I have to learn pretty 
soon).

  exit(EXIT_SUCCESS);
   /*
    proper posix way to exit.
   */
   return 0;

Which one do you mean is the proper POSIX way of exiting? the exit 
function? or return 0? I always put return 0; though my incompetent 
instructor doesn't even put it. But I haven't seen the exit() function 
before, well, I haven't studdied the POSIX standard !!! 

Also, what does sizeof() do? from the code it seems to me it is used for 
counting. Am I right?

You use if (((char)tempValue) == EOF) to determine EOF. I


The way I have learned, I use the getchar() function to do so, as in 
while ( (tmp = getchar() ) != EOF )

Any advantages to any method? 

Also now that I am here, let me abuse your knowledge, and ask one more 
thing. I just learned the gets() function, and when I use it on my gcc 
3.2, it gives me a "the gets function is dangerous. It shouldn not be 
used" warning. I guess gets is now deprecated, but it is still being 
tought in our univ. Do you know what is the correct way of inputting a 
string of characters, not using gets ?

Thanks again, very very much.

Cheers
-- 
/*  Trademarks, Copyrights, Patents, etc are all loans from the public 
domain. They are not a property ('intellectual' or otherwise.) */
        

Aryan Ameri




reply via email to

[Prev in Thread] Current Thread [Next in Thread]