A question about a subject in the "C Unleashed" book

Discussion in 'C Programming' started by Mattjack40, Apr 8, 2005.

  1. Mattjack40

    Mattjack40 Guest

    Thanks Peter.


    Matt




    Mattjack40 wrote:
    > In page 37 the book says"


    > stuct like


    > stuc FOO foo
    > memset(&foo,0, sizeof foo);


    > is not guranteed to have the desired effect if the structure
    > definition of FOO contains floating point numbers or pointers.
    > The book recommands usigng {0} to do the job. (struct FOO foo={0})


    > My question is that we can initialize a stucture in the beginning
    > of the program using {0} but what about ,for example, middle of a
    > program?


    static struct Foo foo_zero = { 0 };
    struct Foo foo;
    ..
    foo = foo_zero;

    --
    Peter
     
    Mattjack40, Apr 8, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark

    aspnet unleashed store

    Mark, Nov 7, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    415
  2. ---
    Replies:
    30
    Views:
    1,937
    George Neuner
    May 26, 2004
  3. Bill Cunningham

    C Unleashed

    Bill Cunningham, May 14, 2004, in forum: C Programming
    Replies:
    15
    Views:
    902
    Dan Pop
    May 21, 2004
  4. Bert Szoghy

    C Unleashed cd split in half

    Bert Szoghy, Jul 20, 2004, in forum: C Programming
    Replies:
    9
    Views:
    357
    Richard Bos
    Jul 22, 2004
  5. safiuddin

    can i get a pdf book for c unleashed

    safiuddin, Mar 5, 2005, in forum: C Programming
    Replies:
    1
    Views:
    386
    Luke Wu
    Mar 5, 2005
Loading...

Share This Page