Search:

Type: Posts; User: cs32

Page 1 of 3 1 2 3

Search: Search took 0.02 seconds.

  1. question about runtime error when deallocating pointer in struct

    Simple question. I have a char pointer in a struct. When I try to free it, I get the following error at run time:

    a.out(1186) malloc: *** error for object 0x1ffc: Non-aligned pointer being freed...
  2. Replies
    2
    Views
    2,829

    initializing structure variables

    Given the following code:


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

    typedef struct foo {
    int test;
    char b;
    } foo;
  3. Replies
    9
    Views
    2,603

    I'm trying to create an array of pointers. I'm...

    I'm trying to create an array of pointers. I'm obviously way off base here.
  4. Replies
    9
    Views
    2,603

    OK - I'm a little bit confused. Why do I get a...

    OK - I'm a little bit confused. Why do I get a compiler warning with the following code:


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

    int
    main(int argc, char *argv[]) {

    int foo[5];
  5. Replies
    9
    Views
    2,603

    array of pointers in struct

    Here's a small piece of code that I'm having some trouble with.


    typedef struct my_struct {
    ...
    int *current_items;
    } my_struct;

    my_struct *s = malloc(sizeof(my_struct));...
  6. Thread: Struct allocation

    by cs32
    Replies
    3
    Views
    2,971

    Struct allocation

    Simple question for you guys:

    Given the following struct:


    typedef struct mystruct {
    char *c;
    int i;
    } mystruct;
  7. Thread: My shell

    by cs32
    Replies
    3
    Views
    1,894

    This is interesting -- how would I get started on...

    This is interesting -- how would I get started on writing my own shell?
  8. Replies
    1
    Views
    793

    question about freeing resources

    Given the follow struct for a doubly linked list:


    typedef struct Node {
    int value;
    struct Node *next;
    struct Node *previous;
    } nodeT;
  9. Thread: Compiler for C

    by cs32
    Replies
    23
    Views
    2,787

    What do you mean by "narrowing data conversion...

    What do you mean by "narrowing data conversion warnings"?
  10. Replies
    4
    Views
    1,115

    There's a space in between < and s. Removing this...

    There's a space in between < and s. Removing this should fix your problem.
  11. Thread: Array help

    by cs32
    Replies
    3
    Views
    806

    This is how I'd write it: int main(int...

    This is how I'd write it:


    int
    main(int argc, char *argv[]) {

    char *s = "this is my string";
    char *buf;

    int i, x = 0;
  12. Thread: segment notes

    by cs32
    Replies
    2
    Views
    1,186

    My bad - thanks for correcting.

    My bad - thanks for correcting.
  13. Replies
    50
    Views
    5,219

    Sorry, esbo, I use a debugger. I guess I've...

    Sorry, esbo, I use a debugger. I guess I've doomed myself to never having a "sound grasp of C."
  14. Thread: segment notes

    by cs32
    Replies
    2
    Views
    1,186

    segment notes

    From time to time, I like to capture all of the information gleaned from threads that I've been tracking in this forum to a private wiki that I have running off my home server.

    Based on the...
  15. Replies
    21
    Views
    17,319

    difference between a segment and a page

    In this thread, which was unfortunately closed, brewbuck states:



    What's the difference between a segment and a page? And what kind of access controls do we have? Read/write? Anything else? How...
  16. Replies
    36
    Views
    4,329

    Wow - a lot of activity in this thread. : ) My...

    Wow - a lot of activity in this thread. : )

    My question was a purely abstract one. I was interested in knowing exactly what went on behind the scenes when a static variable was used in the context...
  17. Replies
    30
    Views
    2,915

    Forgive my ignorance, but how are you losing 4...

    Forgive my ignorance, but how are you losing 4 bytes?
  18. Replies
    5
    Views
    760

    Post what you have so far and we'll help out.

    Post what you have so far and we'll help out.
  19. Replies
    36
    Views
    4,329

    where are static values stored?

    Given the following code:


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

    int do_something(char *);

    int
    main(int argc, char *argv) {
  20. Replies
    3
    Views
    1,205

    By source file, I meant the *.c file. If I...

    By source file, I meant the *.c file. If I specify foo.h, does the compiler/program look for foo.c in the same location as foo.h?
  21. Replies
    3
    Views
    1,205

    compiling and finding the source

    Dumb question, but when you include a header file in a C program, how does the compiler/program know where to find the source file?
  22. Replies
    7
    Views
    1,076

    Sorry to hijack the thread, but when you free a...

    Sorry to hijack the thread, but when you free a Node, do you also have to manually free the pointers within, such as next and prev, or does freeing the Node automatically take care of that for you?
  23. OK. This is what I have (headers intentionally...

    OK. This is what I have (headers intentionally excluded). Same compile error.


    typedef struct nodeT node;

    typedef struct {
    int value;
    node *next;
    } nodeT;
  24. compilation error when attempting to set struct pointer

    I've run into a bit of a snag with the following code that is perhaps a result of me not fully understanding how to deal with pointers in a struct.


    typedef struct {
    int value;
    struct nodeT...
  25. Replies
    6
    Views
    2,102

    Thanks for reviewing! What do you mean?

    Thanks for reviewing!



    What do you mean?
Results 1 to 25 of 71
Page 1 of 3 1 2 3