Thread: Definition, Assignment, Declaration

  1. #1
    Registered User
    Join Date
    Apr 2008

    Definition, Assignment, Declaration

    I know that the first is a declaration, and the second is an assignment:
    int a;
    a = 1;
    What does it mean by "if an identifier is defined"? Has it been declared and assigned or just declared?

    Question is regarding macro directives: #ifdef and defined

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Perhaps give an example of what you are having issues with, unfortunately C has "overloaded definitions" of 'define'.

    #include <stdio.h>
    #define FOO /* comment this out, compile, and compare */
    #if defined FOO
    const char text[] = "foo";
    const char text[] = "bar";
    int main()
       return 0;
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. declaration or definition
    By BEN10 in forum C Programming
    Replies: 5
    Last Post: 07-19-2008, 07:50 PM
  2. My first game
    By homeyg in forum Game Programming
    Replies: 20
    Last Post: 12-22-2004, 05:25 PM
  3. Declaration vrs Definition
    By curlious in forum C++ Programming
    Replies: 1
    Last Post: 09-03-2004, 07:13 PM
  4. please help me
    By insane in forum Game Programming
    Replies: 8
    Last Post: 05-12-2003, 12:40 AM
  5. Templated function (declaration and definition)
    By Eibro in forum C++ Programming
    Replies: 2
    Last Post: 03-11-2003, 08:07 PM