Thread: Please help, about limits .h

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    5

    Please help, about limits .h

    I try to compile this piece of code but i got error like this: error: ‘UNIT_MAX’ undeclared (first use in this function)

    my code:

    #include<stdio.h>
    #include<limits.h> /*for UNIT_MAX*/
    int main(void)
    {
    int i;
    unsigned u = UNIT_MAX;

    printf("The largest unsigned int is %u\n\n", u);
    for(i = 0; i < 10; ++i){
    printf("%u + %d = %u\n", u, i, u + i);
    }
    for(i = 0; i < 10; ++i){
    printf("%u * %d = %u\n", u, i, u * i);
    }
    return 0;
    }
    Last edited by kelai; 10-09-2010 at 03:13 PM.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Not UNIT_MAX - UINT_MAX!

    And use those code tags (the # in the top of the advanced reply window), around your program.

  3. #3
    Registered User
    Join Date
    Sep 2010
    Posts
    5
    Thanks for your reply.

    I tried many time for use # around my code but it did not work.

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by kelai View Post
    Thanks for your reply.

    I tried many time for use # around my code but it did not work.
    You are welcome.

    You don't use # around your code. Instead, click on the # icon in the top bar of the advanced reply window, and IT puts the two code tags onto the page. Then just paste your code between the provided [..code] <code goes here> [../code] tags.

    Then your code will look like code, instead of squished html text. Much better for studying.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Splitting template classes between .h and .cpp files
    By Neo1 in forum C++ Programming
    Replies: 12
    Last Post: 01-16-2010, 05:47 AM
  2. .h file help
    By Rune Hunter in forum C++ Programming
    Replies: 3
    Last Post: 02-06-2005, 02:49 PM
  3. Difference between .h and .c files
    By Metalix in forum C Programming
    Replies: 9
    Last Post: 01-19-2005, 08:38 PM
  4. placement of (.h) and (.cpp) files..!?
    By matheo917 in forum C++ Programming
    Replies: 3
    Last Post: 02-22-2003, 06:37 PM
  5. including an .h file
    By Smiley0101 in forum C++ Programming
    Replies: 3
    Last Post: 02-08-2003, 12:22 PM