Help in c pointers




HI

int *p;
*p = 4;

char * msg;
*msg = 'c';

printf("msg is %s",msg);


when i try to pass a value 4 to place what integer pointer p points to
it says seg fault

but for the char pointer it works fine.

Why this behaviour

Help

.



Relevant Pages

  • race condition?
    ... logit(LOG_DEBUG, "put debug msg here"); ... logfile then creates a FIFO and opens it for reading. ... logit(int priority, const char *msg) ...
    (comp.unix.programmer)
  • Re: How connect PC Embedded to MDB (Vending Machine)
    ... char by using the mark/space parity control. ... can filter on the 9th bit set (MDB address mode). ... msg within 5mS. ... device response time at best. ...
    (comp.arch.embedded)
  • Re: How connect PC Embedded to MDB (Vending Machine)
    ... char by using the mark/space parity control. ... msg within 5mS. ... device response time at best. ... be 72mS + device response time. ...
    (comp.arch.embedded)
  • Re: Segmentation fault when compiled binary is executed
    ... > instruction in a++ mode ... You may be thinking of "sequence of char ... Quite apart from the hazards involved in using %s with scanf, ... This is almost certainly the cause of your seg fault. ...
    (comp.lang.c)
  • Re: size of structure
    ... If have a struct defined like this: ... char guid; ... char * msg; ... If msg points to a string, the size of the array containing the string ...
    (comp.lang.c)