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

  • SEARCH
  • Home
  • 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 9324089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T04:30:35+00:00 2026-06-19T04:30:35+00:00

printf("%d, ", packet[i]); How to display variable correctly. It should be from 0 to

  • 0

printf("%d, ", packet[i]);

How to display variable correctly. It should be from 0 to 255
but if I use %d it prints:

-1 as 255

up to the number 128 is displayed correctly, larger are negative.

when I use %u it prints 4294967295 instead of 255.

  • 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-19T04:30:37+00:00Added an answer on June 19, 2026 at 4:30 am

    Use %hhu conversion specification:

    printf("%hhu, ", packet[i]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

glibc's printf("% .0d",0) prints a space, and printf("%+.0d",0) prints a plus sign, and the
The printf() function will return the number of characters printed. But in the code
I have C code that uses prints with something clever like printf("hello "); //
Is the following C++ code well-formed? void consumer(char const* p) { std::printf("%s", p); }
Why do I get a syntax error from print "Hello World" in Python 3.2?
I have the string "re\x{0301}sume\x{0301}" (which prints like this: résumé) and I want to
In the following example, the program should print "foo called\n" : // foo.c #include
strncpy() supposedly protects from buffer overflows. But if it prevents an overflow without null
Say you have a C code like this: #include <stdio.h> int main(){ printf("Hello, world!\n");
#include <stdio.h> #include <limits.h> int main(void){ printf("Type Size Min Max\n----------------------------------------------------------------------\n"); printf("%-20s%-10d%-20ld%-20ld\n", "long", sizeof(long), LONG_MIN,

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.