TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Len Philpot
from: Jasen Betts
date: 2004-01-28 08:05:40
subject: [C] Question about external variable initialization

Hi Len.

23-Jan-04 18:59:58, Len Philpot wrote to All

 LP>         ext_int = 5;

 LP>         /* ...and likewise for ext_char_arr[] */
 LP>         ext_char_arr[0] = "element zero";
 LP>         ext_char_arr[1] = "element one";
 LP>         ext_char_arr[2] = "element two";


 LP> but I still haven't achieved what I want - To move the
 LP> initialization of the elements of ext_char_arr[] out
 LP> into its own file, or at least out of the main() file.

 try this:

 -+- ext2.c ---------------------------------------------------------


  #include 
  /* will cause warnings if the variable types don't match between this */
  file and ext.h */

  /* these 3 are definitions, and initializations */
  int ext_int=5;
  char ext_char[] = "zoom";
  char *ext_char_arr[3]={"element zero",
                         "element one",
                         "element two"};

 -=> Bye <=-

---
* Origin: I'm pink, therefore I'm SPAM. (3:640/1042)
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.