Need Help on C...

Discussion in 'Programming/Html' started by Vincent MacLeod, Feb 29, 2004.

  1. Vincent MacLeod

    Vincent MacLeod Ancient Guru

    Messages:
    1,556
    Likes Received:
    0
    GPU:
    MSI GeForce4 MX 440 64MB
    These exercises are based on the following declarations, where the type Node is declared as follows.

    typedef struct node {
    char c;
    struct node *next;
    } Node;

    Node *p, *q, *r;
    Node x, y, z;

    For each of the following statements, either describe its effect, or state why it is illegal.

    a) p = (Node *)malloc(sizeof(Node));
    b) q* = (Node *)malloc(sizeof(Node));
    c) x = (Node *)malloc(sizeof(Node));
    d) p = r;
    e) q = y;
    f) r = NULL;
    g) z = *p;
    h) p = *x;
    i) free(y);
    j) free(*p);
    k) free(r);
    l) *q = NULL;
    m) *p = *x;
    n) z = NULL;


    hahaha, can hep me on this one?

    Thankz:D
     

Share This Page