Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8509261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:23:12+00:00 2026-06-11T03:23:12+00:00

size_t is declared as unsigned int so it can’t represent negative value. So there

  • 0

size_t is declared as unsigned int so it can’t represent negative value.
So there is ssize_t which is the signed type of size_t right?
Here’s my problem:

#include <stdio.h>
#include <sys/types.h>

int main(){
size_t a = -25;
ssize_t b = -30;
printf("%zu\n%zu\n", a, b);
return 0;
}

why i got:

18446744073709551591
18446744073709551586

as result?
I know that with size_t this could be possible because it is an unsigned type but why i got a wrong result also with ssize_t??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:23:14+00:00Added an answer on June 11, 2026 at 3:23 am

    In the first case you’re assigning to an unsigned type – a. In the second case you’re using the wrong format specifier. The second specifier should be %zd instead of %zu.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given: typedef type-declaration synonym; I can see how: typedef long unsigned int size_t; declares
const size_t size = 5; int *i = new int[size](); for (int* k =
As title: is size_t always unsigned, i.e. for size_t x , is x always
Is there is a difference between size_t and container::size_type ? What I understand is
I have a variable of type size_t , and I want to print it
I have old code that uses size_t which IIRC comes from cstring.h. On OS
I can't understand this result... The code: void foo(void * key, size_t key_sz) {
Other than the size of the values that each type can hold, what are
If I declare a Union as: union TestUnion { struct { unsigned int Num;
struct MyClass { int foo () { return 0; } }; unsigned int size

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.