Search:

Type: Posts; User: occams razor

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    1,683

    Hi Zacs7, yes it is already a pointer to a linked...

    Hi Zacs7, yes it is already a pointer to a linked list...

    what I'm saying is from main() the code using 'g' will print out the entire set of lists iterating down the array of pointers...

    but...
  2. Replies
    3
    Views
    1,683

    A question about pointers in functions

    I'm programming (in Ansi C) an adjacency list of an array with each element pointing to a list of structs and compiling with

    gcc -Wall -ansi -pedantic -O *.c

    my question is simply that from...
  3. Replies
    7
    Views
    1,766

    I've tried starting from the far end but have...

    I've tried starting from the far end but have just made myself confused... tonight I'll have to go and nut out the algorithm a bit better I think. Its dinner time here now and probably part of it is...
  4. Replies
    7
    Views
    1,766

    Hi Salem, thanks for replying. A constraint on...

    Hi Salem, thanks for replying. A constraint on the learning exprience of this exercise is for me to use the structs as defined so I never chose the [1000]. I'm just finding it hard to come to terms...
  5. Replies
    7
    Views
    1,766

    At this point I am inserting the new student in...

    At this point I am inserting the new student in the right place but the loop overwrites every member for the rest of the student struct... any ideas on how I might efficiently shuffle these along to...
  6. Replies
    7
    Views
    1,766

    Thanks for the reply... The student struct...

    Thanks for the reply...

    The student struct doesnt have a next so only the nodes (units) are a linked list. [ADDED: -- The nodes are sorted by name in ascending order, these are courses BUT each...
  7. Replies
    7
    Views
    1,766

    sorting in a struct within a struct

    this one has had me stuck for a few days and I am wondering if it is my idea of what is happening here that is askew...



    typedef struct node *node_ptr;

    struct node {
    char *name;
    ...
  8. Replies
    4
    Views
    2,378

    no i have found the issue is in main... I'll work...

    no i have found the issue is in main... I'll work on it tomorrow and try to see what happened. I have a bit of junk code that compiled - thanks for looking at it though, greatly appreciated. :)
  9. Replies
    4
    Views
    2,378

    no, I realised n had no string being passed in......

    no, I realised n had no string being passed in... but unfortunately its still returning the exact same pointer no matter what - it returns NULL if its not in there but otherwise it returns the same...
  10. Replies
    4
    Views
    2,378

    sorry salem that ; shouldn't be there... :) ...

    sorry salem that ; shouldn't be there... :)

    without the ; ...

    I've noticed another issue with a previously working method not working at all so the problem may be elsewhere... does the find...
  11. Replies
    4
    Views
    2,378

    strcmp on a linked list to a string n

    I have a problem working this one out for strings... this small function should return a pointer to fred for example if fred were in the list or NULL otherwise, a simple find operation. The output...
  12. Replies
    8
    Views
    11,944

    thanks Salem, I'll read the FAQ and scratch my...

    thanks Salem, I'll read the FAQ and scratch my head and wonder why I never even thought of that one... I am pretty new at C though for sure. :)
  13. Replies
    8
    Views
    11,944

    so basically at this point I can't really see why...

    so basically at this point I can't really see why I'm getting those two cast errors on the second malloc and the strcpy functions...

    any suggestions?
  14. Replies
    8
    Views
    11,944

    #include #include #include...

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include "list.h"
  15. Replies
    8
    Views
    11,944

    oh sorry... yes I have it in the top of the file...

    oh sorry... yes I have it in the top of the file with the function as the first malloc doesnt' throw an error...


    #include <stdlib.h>
  16. Replies
    8
    Views
    11,944

    Hi, yes I think the header is alright but just to...

    Hi, yes I think the header is alright but just to check...


    #include "list.h" /* is on the same page as the function */

    list.h contains:


    typedef struct node *node_ptr;
    struct node
  17. Replies
    8
    Views
    11,944

    inserting strings into linked list nodes

    I've got a function which should malloc for a new node and then for space for a string in the data_item part of the node... but for the life of me I can't figure out why I get two errors... here is...
Results 1 to 17 of 17