if you really have to do it in a low-level language, do it in assembly native to that processor. you can even write them inline within your C code.
asm(" mnemonic_instruction operand, operand"); At Friday, 12 December 2003, Alex Malinovich <[EMAIL PROTECTED] shack.net> wrote: >On Fri, 2003-12-12 at 14:04, Wesley J Landaker wrote: >> On Friday 12 December 2003 11:38 am, Aryan Ameri wrote: >> > Hi There: >> > >> > I am a first year CS student, learning C. A while ago I was asked >> > this question from a fellow friend of mine: >> > >> > "Write a program, which promts the uset to enter some numbers. The >> > user should terminate the sequence of numbers by entering EOF >> > character. The program should put numbers entered by the user in to a >> > 1D array". >> >> Hmmm... sounds a lot like a homework problem... =) >> > >Yes, it does... :) > >> Of course, the normal way to do something like this is to not use C, >> since it's way more low-level than you need. > >But since the OP did say he was a CS major, I'd imagine that the whole >point would be to do it in a very low level language. :) > >> It would be better to allocate memory in chunks, or better yet, do >> something like read the numbers into a linked-list and then copy them >> to an array when you're ready to use them that way, or to use C++ and >> use the <vector> class, or something like that. > >I definitely agree with the linked-list suggestion. I had thought that >most intro CS courses already cover linked list implementations. Either >way, if you haven't had linked lists as part of your curriculum yet, >learn how to do them now and it will put you ahead of the game for a lot >of your courses. The course that I took that introduced linked lists >took the better part of the semester to cover them though, in my >opinion, one or two labs max would have been sufficient. > >And I wouldn't even bother putting the linked list into an array in the >first place. If you write a good linked list implementation (which, as I >said, would be a good exercise) it will already support all of the >functions that you're likely to need with an array, so you might as well >just keep it as a linked list. > >-- >Alex Malinovich >Support Free Software, delete your Windows partition TODAY! >Encrypted mail preferred. You can get my public key from any of the >pgp.net keyservers. Key ID: A6D24837 > >Attached file >Save attachment >View attachment as text > Name: signature.asc > Type: application/pgp-signature > > -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]