home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / c / 12642 < prev    next >
Encoding:
Text File  |  1992-08-21  |  1006 b   |  39 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!decwrl!deccrl!caen!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!lynx!triton.unm.edu!rsahu
  3. From: rsahu@triton.unm.edu (Raikanta Sahu)
  4. Subject: Simple C question 
  5. Message-ID: <_c+nnmp@lynx.unm.edu>
  6. Date: Sat, 22 Aug 92 06:22:23 GMT
  7. Organization: University of New Mexico, Albuquerque
  8. Distribution: unm
  9. Lines: 28
  10.  
  11. I thought the following piece of code was perfectly legal.
  12. --------------------------------------------------------
  13. #include <stdio.h>
  14.  
  15. main()
  16.  
  17. {
  18.  char s[] = "Hello world!" ;
  19.  
  20.  printf("OK \n" ) ;
  21. }
  22. ---------------------------------------------------------
  23.  
  24. Here is what I get from the compiler.
  25.  
  26. ccom: Error: test.c, line 6: no automatic aggregate initialization
  27.        char s[] = "Hello world!" ;
  28.       ----------^
  29. ccom: Error: test.c, line 6: illegal lhs of assignment operator
  30.        char s[] = "Hello world!" ;
  31.       ---------------------------^
  32.  
  33.  
  34. Can anybody please explain why automatic initialization is not accepted ?
  35.  
  36. Thanks.
  37.  
  38. -sahu,r 
  39.