User Profile

Collapse

Profile Sidebar

Collapse
randomstring
randomstring
Last Activity: Dec 3 '12, 07:06 AM
Joined: Mar 13 '12
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • randomstring
    replied to Strings in C
    in C
    Banfa, you're right, my input string was a pointer to something that didn't exist past the function that generated it. (Grr, dumb error that took hours to debug and two seconds to fix.) Thanks for all your help! I much appreciate your looking at my code and helping me fix/debug it.
    See more | Go to post

    Leave a comment:


  • randomstring
    replied to Strings in C
    in C
    Thanks, Banfa! I fixed the error you pointed out on line 14.

    Meanwhile, I'm sorry to report that the code still isn't working for me at all. As I step through the code line by line, the debugger shows that if validNum is (123)456-7890, then as the function executes, on line 10 validNum changes to (123)456-7. On line 11, it changes to (123)45, and so on. Ultimately what gets returned is a string with just the second char "1"....
    See more | Go to post

    Leave a comment:


  • randomstring
    started a topic Strings in C
    in C

    Strings in C

    Hello. I'm new to C, and trying to figure out why some code I wrote isn't working. The code is supposed to receive a telephone number that could be formatted with digits, parenths, or dashes. It is supposed to strip out the parenths and dashes, retaining just the digits. Here's the code:

    Code:
    char* formatNum (char* validNum) {
        
        int counter;
        int index;
        int length;
        char* numOut;
    ...
    See more | Go to post
    Last edited by randomstring; Mar 13 '12, 09:22 AM. Reason: Added tag for C programming
No activity results to display
Show More
Working...