Search:

Type: Posts; User: edw211

Search: Search took 0.01 seconds.

  1. I just ran my debugger and see that now. Thanks a...

    I just ran my debugger and see that now. Thanks a lot! =)
  2. Would adding a "length == pos" condition like...

    Would adding a "length == pos" condition like this fix the problem? It should ensure that I've not surpassed the limit. Seems to fix the problem when I test it:



    /* getline (MODIFIED): read a...
  3. Ah, right you are. Thanks.

    Ah, right you are. Thanks.
  4. K&R Exercise 1-16: Modifying a getline() function

    This exercise asks me to rewrite a getline() function. Originally, it stored up to 1000 chars of the line in an array and returned the length of the line. However, the function would not return the...
  5. Ohhhhh, it all makes sense now then. Okay,...

    Ohhhhh, it all makes sense now then. Okay, thanks. I had forgotten about short-circuiting. I was thinking as though everything in the loop condition was carried out with every test.
  6. Is there an off-by-one error in this example code?

    Right, so in a K&R exercise, I'm supposed to modify this code (which I haven't touched yet). It currently uses the getline() function to read in lines from input, find the longest one, and output it...
  7. Replies
    8
    Views
    13,414

    No problem. Good luck with the rest of your...

    No problem. Good luck with the rest of your program.
  8. Replies
    8
    Views
    13,414

    Someone correct me if I'm wrong, but you don't...

    Someone correct me if I'm wrong, but you don't need to use pointer syntax here because the name of an array itself functions as a pointer. These modifications to your code worked for me:

    ...
  9. Replies
    6
    Views
    2,303

    Ohhh yeah, right you are. Not sure why I did...

    Ohhh yeah, right you are. Not sure why I did that.

    And thanks, CommonTater.

    One other question. I've been defaulting to using putchar() if I only need a single character because I'm assuming...
  10. Replies
    6
    Views
    2,303

    K&R Exercise 1-14 - Looking for Critique

    Hello all,

    I'm currently working my way through the K&R book and am doing all the exercises as I come across them. This exercise asks me to write a program that prints out a histogram of the...
  11. Replies
    4
    Views
    2,014

    Well, I realized I don't have infinite amounts of...

    Well, I realized I don't have infinite amounts of horizontal room over which to display every possible length, so I group 20 or more character-long words in the same category. When I display the...
  12. Replies
    4
    Views
    2,014

    Those functions do look useful for what I'm...

    Those functions do look useful for what I'm doing. I think the point of the exercise, though, is to implement a solution using only the tools Kernighan and Ritchie have described so far. I feel like...
  13. Replies
    4
    Views
    2,014

    Files that do not end with newline?

    Earlier I posted a program as a solution to a K&R exercise that reads a file/text stream and prints out a histogram of number of occurrences of word lengths. I think I've worked out nearly all the...
  14. Thread: Homework Help

    by edw211
    Replies
    8
    Views
    1,289

    Seems rather convoluted, but whatever gets you a...

    Seems rather convoluted, but whatever gets you a passing mark, I guess, haha.

    And no problem, good luck.
  15. Thread: Homework Help

    by edw211
    Replies
    8
    Views
    1,289

    I'm a newbie, but I do notice a few things here:...

    I'm a newbie, but I do notice a few things here:

    -you capitalized CalcOut() in your prototype; in your definition, you refer to it as calcOut().

    -don't use gets(). You should use the safe...
  16. Ohhh, so that's probably why I often see CR and...

    Ohhh, so that's probably why I often see CR and LF in writing grouped together as CRLF, then? So CRLF means \r\n located in a file written in Windows that got onto a different OS, where just an \n...
  17. If I'm not mistaken, '\r' returns the active...

    If I'm not mistaken, '\r' returns the active position to the beginning of the current line. Just curious, what kind of file or situation would a '\r' crop up in as far as this program is concerned? I...
  18. Ohhhh okay, I gotcha. Yeah, K&R, for this...

    Ohhhh okay, I gotcha. Yeah, K&R, for this exercise anyway, defines a word loosely as a contiguous group of non-whitespace characters. Not sure what \v is though, will have to look that up or wait...
  19. Didn't know I could initialize the array that...

    Didn't know I could initialize the array that way, thanks. I haven't gotten up to <ctype.h> yet. I implemented this using only what I learned in the stuff I've read so far. You're right, I should...
  20. Another K&R Exercise... Looking for a critique

    Hello all, I'm on Exercise 1-13 of K&R and am really trying to focus on learning how to come up with a solution that scales well and is easily modifiable. This exercise asks me to implement a program...
  21. Replies
    2
    Views
    1,294

    Okay cool; I think that's pretty much what I was...

    Okay cool; I think that's pretty much what I was trying to say, but in less words. Thanks for the confirmation, Salem. Glad I finally understand that.

    Cheers =)
    -Evan Williams
  22. Replies
    2
    Views
    1,294

    Clarification of K&R Exercises

    Hello all,

    I'm a college guy trying to bone up on my C skills by progressing through the K&R exercises. Here are the two I am concerned with:

    1-8: Write a program to count blanks, tabs, and...
Results 1 to 22 of 22