Search:

Type: Posts; User: itsthemac

Search: Search took 0.00 seconds.

  1. Replies
    5
    Views
    3,292

    Hmm... Thanks, but now I'm kinda worried. I have...

    Hmm... Thanks, but now I'm kinda worried. I have no clue what to do.
  2. Replies
    5
    Views
    3,292

    not sure how to set static global pointer

    I have the following code:


    // --------------- Global Variables ---------------
    static char array[100];
    static char * ptr;

    // ------------------------------------------------
    void foo()
    {
  3. Replies
    7
    Views
    1,792

    Ok, thanks. I think my problem was that I thought...

    Ok, thanks. I think my problem was that I thought that the assignment statement evaluated to the value being assigned. But I guess it evaluates to the value of the thing on the left of the assignment...
  4. Replies
    7
    Views
    1,792

    Thanks, got it to work using your suggestions. I...

    Thanks, got it to work using your suggestions. I never thought about the evaluation order thing, I'll keep it in mind for the next time I run into something like this. Now I have a follow-up question...
  5. Replies
    7
    Views
    1,792

    Getting weird results with isalpha

    I wrote the following little test program to test out the isalpha function:


    #include <stdio.h>
    #include <ctype.h>
    #include <stdlib.h>

    main(int argc, char * argv[] )
    {
    FILE * fp =...
  6. Thanks! I had no idea about strdup. For some...

    Thanks! I had no idea about strdup. For some reason I just assumed malloc-ing strings was a faux pas, but I couldn't see any other way around this problem. cheers
  7. Problem making strings in a malloc-ed struct

    I have a struct with the following definition:


    struct node{
    char * name;
    struct node * next;
    };

    The problem is that I want to make a linked list of these nodes, each having its own...
  8. Thank you everyone for the help!

    Thank you everyone for the help!
  9. A few questions about string literals and inputting strings

    I'm trying to gain a better intuition on how string literals work in C.


    char * c = "hello";

    c = "goodbye";
    After the code segment above completes, what happens to the space in memory where...
  10. Replies
    5
    Views
    1,642

    thank you very much!

    thank you very much!
  11. Replies
    5
    Views
    1,642

    Ok, cool thanks. Just as an aside, is there any...

    Ok, cool thanks. Just as an aside, is there any difference between saying

    char str[] = "String";
    and

    char * str = "String";?
  12. Replies
    5
    Views
    1,642

    very basic question about char *

    I'm new to c and need to take in a string (char *) and cut it down into its individual words. I'm not sure what the most efficient way to do this would be. For example if given the string "This is a...
Results 1 to 12 of 12