Thread: size_t

  1. #1
    Registered User
    Join Date
    Feb 2018
    Posts
    24

    size_t

    we know "size_t" as an unsigned integer but i can give negative value to a variable and print it ? so what would i use this size_t for a reason ?

  2. #2
    Guest
    Guest
    You can assign a negative integer to size_t, but the value will be positive (wrap around).

    Post sample code of your problem if you need further clarification.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    we know "size_t" as an unsigned integer
    Actually all we "know" is that size_t is an implementation defined unsigned type, it not necessarily an unsigned int. It could be any unsigned type such as an unsigned long, unsigned long long, unsigned int, or even an unsigned short.

  4. #4
    Registered User
    Join Date
    Feb 2018
    Posts
    24
    Quote Originally Posted by jimblumberg View Post
    Actually all we "know" is that size_t is an implementation defined unsigned type, it not necessarily an unsigned int. It could be any unsigned type such as an unsigned long, unsigned long long, unsigned int, or even an unsigned short.
    now i totally understand thank you my friend

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. size_t
    By KemalT in forum C Programming
    Replies: 5
    Last Post: 02-09-2015, 04:02 PM
  2. size_t
    By bos1234 in forum C Programming
    Replies: 1
    Last Post: 03-04-2011, 05:43 AM
  3. what is size_t?
    By droseman in forum C Programming
    Replies: 4
    Last Post: 01-27-2009, 11:34 AM
  4. when to use size_t ?
    By broli86 in forum C Programming
    Replies: 3
    Last Post: 06-27-2008, 10:13 AM
  5. size_t
    By falconetti in forum C Programming
    Replies: 2
    Last Post: 02-25-2002, 08:52 AM

Tags for this Thread