Search Results

Search found 1 results on 1 pages for 'skynorth'.

Page 1/1 | 1 

  • C pointer question, dereferencing crash

    - by skynorth
    Why do this work? int *var; while(scanf("%d", &var) && *var != 0) printf("%d \n", var); While this does not? int *var; while(scanf("%d", &var) && var != 0) printf("%d \n", var); Doesn't * (dereference operator) give you the value pointed by the pointer? So why does *var != 0 crash the program, while var != 0 does not?

    Read the article

1