Thread: newbie structure question...

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    12

    newbie structure question...

    howdy

    i'm a python/java guy who's going to attempt to pick up C/C++, and so far it's pretty straightforward. I do have one question regarding structures...

    in all the examples i've seen, when a structure is created, it never initializes the variables to values, it just declares the variable and it's type. is it possible to initialize a variable within a structure when the structure is created?

    here's an example of what i mean:
    Code:
    struct ink {
        char name[60] = "inkedmn";
        int age;
    };
    will that work? (i'm at work and can't test it, i was just curious)

    thanks!
    Last edited by inkedmn; 04-17-2003 at 11:57 AM.
    Brett Kelly

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. newbie: array question :(
    By cstudent in forum C Programming
    Replies: 2
    Last Post: 04-09-2008, 06:46 AM
  2. pointer to structure question
    By matthughes in forum C Programming
    Replies: 8
    Last Post: 05-19-2007, 01:07 AM
  3. Structure and Linked List User Input Question
    By kevndale79 in forum C Programming
    Replies: 16
    Last Post: 10-05-2006, 11:09 AM
  4. Total Newbie Question
    By Kid A in forum C++ Programming
    Replies: 4
    Last Post: 06-22-2006, 05:36 AM
  5. structure question
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 05-17-2002, 09:17 PM