Why does this cause an segmentation fault?

From: Ronny Iversen (ronnyi@ifi.uio.no)
Date: 11/27/98


#include <stdio.h>

#define LOWER(c) (((c)>='A'  && (c) <= 'Z') ? ((c)+('a'-'A')) : (c))
#define UPPER(c) (((c)>='a'  && (c) <= 'z') ? ((c)+('A'-'a')) : (c) )

#define ISNEWL(ch) ((ch) == '\n' || (ch) == '\r')

#define CAP(st)  (*(st) = UPPER(*(st)), st)

void main(void) {
  register char *i = NULL;
  i = "someone";
  CAP(i);
}

Noc

--
--------------- Codito, ergo sum - "I code, therefore I am" --------------------

http://birk113.studby.uio.no                                   ronnyi@ifi.uio.no

---------------- In a world without fences, who need gates? --------------------


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST