Search:

Type: Posts; User: ModeSix

Search: Search took 0.02 seconds.

  1. Interesting idea. I will try this and see how it...

    Interesting idea. I will try this and see how it works out.



    char menu(void)
    {
    char reply;
    //char buf[BUFSIZ];

    puts("\nEnter 1 for task A");
  2. I finally realized what was happening, and found...

    I finally realized what was happening, and found information about converting strings to integers.

    Ended up using this code for my menu() function and it does the trick. Thanks for pointing me in...
  3. While I appreciate the concise answer, could you...

    While I appreciate the concise answer, could you point me towards what I need to look at in the FAQ, I've gone through a bunch of it and have no been able to find an answer that related to C, but I...
  4. case, menu system, loops infinitely on invalid input

    I am having a problem with a menu system, it's a sample menu system that I am putting together to make sure it will work, theoretical reasons, just trying to learn.

    When an invalid value is...
  5. Replies
    21
    Views
    10,964

    So I have come up with the following method,...

    So I have come up with the following method, since it's within the scope of what I have learned so far from my book. I am getting some strange output though.



    /* concatenate two strings and...
  6. Replies
    21
    Views
    10,964

    I wasn't taking your source code and using it,...

    I wasn't taking your source code and using it, but I didn't understand the logic behind it. So I came up with my own version of it as you can see in my latest posting.
  7. Replies
    21
    Views
    10,964

    Alright so the refined and working function to...

    Alright so the refined and working function to find string length is completed. Overall resulting in a much more compact program.



    /* concatenate two strings and malloc() memory to store a...
  8. Replies
    21
    Views
    10,964

    While I am sure the function you provided works...

    While I am sure the function you provided works as intended, I don't understand the logic behind it.

    I'm still working from a pretty basic knowledge pool and rather than just using an example I...
  9. Replies
    21
    Views
    10,964

    I've managed to get the allocation function and...

    I've managed to get the allocation function and length calculations working properly, and yes I should probably break this into other functions, which I will do shortly.

    I am going to have to...
  10. Replies
    21
    Views
    10,964

    I've refined the function and it's not producing...

    I've refined the function and it's not producing errors, as well as allocating memory correctly. Now to concatenate the two strings together.




    char link_array(char first[], char second[],...
  11. Replies
    21
    Views
    10,964

    I think I will attempt to do it both ways,...

    I think I will attempt to do it both ways, because doing it the long way probably will teach me something I need to know down the road for another purpose.

    Now onto my next question.

    When...
  12. Replies
    21
    Views
    10,964

    Amazingly, that was exactly what was happening,...

    Amazingly, that was exactly what was happening, after inputting the two strings, it would just do nothing, which I assume was a direct result of the infinite loop you spoke of.

    I am probably going...
  13. Replies
    21
    Views
    10,964

    I haven't tried compiling it yet, as I hadn't...

    I haven't tried compiling it yet, as I hadn't written the concatenate function yet.

    I'm writing it using Mac OSX XCode for my editor and it's showing warnings on a few lines, I'll compile it and...
  14. Replies
    21
    Views
    10,964

    I haven't learned those functions yet, I am...

    I haven't learned those functions yet, I am working through the book Teach Yourself C in 21 days, and it takes a tutorial approach, this is an end of chapter exercise on working with basic string...
  15. Replies
    21
    Views
    10,964

    Concatenate two strings.

    I am trying to concatenate two strings together into a third string array, and allocating memory to store the third string and return the pointer to it.

    Here is what I have so far.



    /*...
  16. Replies
    6
    Views
    12,811

    Thank you. Is there a way to discard any...

    Thank you. Is there a way to discard any overflow?



    Will this also work with a width modifier? ex: %80[^\n] ?
  17. Replies
    6
    Views
    12,811

    fgets is what I need. Having checked the FAQ it...

    fgets is what I need. Having checked the FAQ it seems my answer is there.

    Thanks.

    For confirmation from the FAQ, please tell me if I am doing this correctly now:



    char input[81];
  18. Replies
    6
    Views
    12,811

    gets() is an unsafe method. Alternatives?

    When executing a simple program I created through tutorials I am working through I am told by my OS that using gets is unsafe.

    Is there an alternative to it that will allow strings to be entered,...
  19. Replies
    23
    Views
    3,353

    Thanks guys. What each of you have said makes...

    Thanks guys. What each of you have said makes sense to me in different ways. I may just be overthinking pointers. I am going to go over the linked tutorial to see if that helps me with the concepts I...
  20. Replies
    23
    Views
    3,353

    On the topic of pointers, I'm going through a...

    On the topic of pointers, I'm going through a well written tutorial book, and I just finished the chapter on pointers, but I left only half satisfied with what I learned. Everything I've learned up...
  21. Replies
    17
    Views
    3,209

    I may or may not be right but you have ...

    I may or may not be right but you have

    scanf("%d %d", &dub1, &dub2);

    remove the & symbols and have it read


    scanf("%d %d", dub1, dub2);
  22. Wow, something so simple that I couldn't even see...

    Wow, something so simple that I couldn't even see it.

    Thanks for the help. :)
  23. lvalue required as left operand of assignment

    I am just learning C programming and and working through 'The C Programming Language' by Dennis Ritchie.

    I am just starting to explore arrays and am working on a sample piece of code in the book...
Results 1 to 23 of 23