Thread: Special use of #define with a struct

  1. #1
    Registered User
    Join Date
    Jul 2015
    Posts
    5

    Special use of #define with a struct

    In C, what does the following code do:

    Code:
    #define CREAL_T 
    typedef struct{ 
    ...
    ... 
    } creal32_T;
    What does the #define statement do?

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Could be an #include guard.

    FAQ > Multiple source files for one program (C++ example) - Cprogramming.com

    It's a C++ example, but for structs, functions, etc. you should do the same thing.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Yeah, if the macro was intended to span several lines, there would have been backslashes at the end of each line except the last used to that effect.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Jul 2015
    Posts
    5
    Thank you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. where do i define a struct in my code using an array class
    By c++noob145 in forum C++ Programming
    Replies: 4
    Last Post: 03-17-2013, 12:42 AM
  2. define string to struct var
    By siperi in forum C Programming
    Replies: 4
    Last Post: 10-22-2010, 08:28 AM
  3. Newbee: Define a struct with scoop outside file?
    By Marcux in forum C Programming
    Replies: 2
    Last Post: 07-18-2007, 12:46 PM
  4. #define within struct definition?
    By fanoliv in forum C Programming
    Replies: 11
    Last Post: 06-23-2006, 06:24 PM
  5. struct and define problem
    By hurry up in forum C Programming
    Replies: 1
    Last Post: 03-19-2003, 11:37 AM