Search Results

Search found 2 results on 1 pages for 'kliketa'.

Page 1/1 | 1 

  • Why freed struct in C still has data?

    - by kliketa
    When I run this code: #include <stdio.h> typedef struct _Food { char name [128]; } Food; int main (int argc, char **argv) { Food *food; food = (Food*) malloc (sizeof (Food)); snprintf (food->name, 128, "%s", "Corn"); free (food); printf ("%d\n", sizeof *food); printf ("%s\n", food->name); } I still get 128 Corn although I have freed food. Why is this? Is memory really freed?

    Read the article

  • best articles about organizing code files in C

    - by kliketa
    Can you recommend me what should I read/learn in order to make a well organized code in C? One of the things I want to learn is the principles of splitting project in .h and .c files, what goes where and why, variable naming, when to use global variables ... I am interested in books and articles that deal with this specific problem.

    Read the article

1