Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Since a size_t is actually an UNSIGNED INT and not an UNSIGNED LONG INT, you should not be using %lu to start with, and since there could be no reason to so, don't claim there is. The best way to avoid your warning is to just use %d. Type casting will get around it, but consider: why do want to use %ul when your variable is not an unsigned long? You could complain that you wanted to use %s as well...or even non existant types like %suv or %lol...
ps. you will have a lot more fun at cprogramming.com with these kinds of questions.
Type casting is an idea. I will use that. But I still don't get why there is no unsigned int output conversion in printf(k).
Frankly speaking, use %d instead of an unsigned integer format is bad. The reason is obvious.
I think he means you should probably be using "%u" (for unsigned int).
It's true that, at least for the C99 standard, size_t is equivalent to unsigned int, and not to unsigned long int, long int or anything else. So, just using the correct format specifier should sort it out without a need for type castings.
Well, the thread is dormant without answer so thought of closing it for anyone who stumbles on this warning. size_t is platform dependent and it's size depends on whether the code is running on 32-bit or 64-bit hardware. For this warning to go away use %zd or %zu as a format specifier, though it's definitely unsigned.