Thread: help on declarations

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    76

    help on declarations

    I am working on trying to declarations and using typedef.
    this is my assignment
    Write and compile a program in C to declare data variables of each of following types: unsigned char, unsigned short, unsigned int, unsigned long int. Use Typedef. Use meaningful names for type definitions. Declare a data variable for each of the type definitions and initialize them with 255, 65535 and 4294967295 respectively. Write the comments for each declaration.

    I have used typedef to remame declarations but now after I declare a variable it will not compile.

    please the my attachment for what I wrote

    I get a compiler log error like this:

    Compiler: Default compiler
    Executing g++.exe...
    g++.exe "C:\Documents and Settings\dustin\My Documents\computer programming class\typedef.cpp" -o "C:\Documents and Settings\dustin\My Documents\computer programming class\typedef.exe" -traditional-cpp -g3 -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -g3
    C:/Documents and Settings/dustin/My Documents/computer programming class/typedef.cpp: In
    function `int main()':
    C:/Documents and Settings/dustin/My Documents/computer programming class/typedef.cpp:10: parse
    error before `=' token

    C:/Documents and Settings/dustin/My Documents/computer programming class/typedef.cpp:10:11: warning: multi-character character constant

    Execution terminated

    I have no clue what I am doing wrong can someone point me in the right direction thank you.
    Last edited by robasc; 03-05-2005 at 10:00 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Does gcc hate Forward declarations?
    By SevenThunders in forum C++ Programming
    Replies: 12
    Last Post: 03-16-2009, 02:03 PM
  2. mixing code with declarations
    By robwhit in forum C Programming
    Replies: 12
    Last Post: 01-31-2008, 12:55 AM
  3. Declarations
    By slippy in forum C++ Programming
    Replies: 13
    Last Post: 12-01-2007, 05:02 PM
  4. portable declarations
    By Marv in forum C Programming
    Replies: 10
    Last Post: 04-12-2007, 04:39 PM
  5. Weird function declarations
    By confuted in forum C Programming
    Replies: 6
    Last Post: 11-09-2005, 03:06 PM