www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/13/11:35:02

Date: Tue, 13 Jun 2000 15:44:34 +0200 (MET DST)
From: pad2369 <pad2369 AT iperbole DOT bologna DOT it>
Message-Id: <200006131344.PAA27047@maggiore.iperbole.bologna.it>
To: djgpp AT delorie DOT com, Alastair Hogge <al_ AT tpg DOT com DOT au>
References: <008501bfd532$7aee9380$de0f3acb AT default>
In-Reply-To: <008501bfd532$7aee9380$de0f3acb@default>
MIME-Version: 1.0
User-Agent: IMP/PHP3 Imap webMail Program 2.0.11
Sender: pad2369 AT iperbole DOT bologna DOT it
Subject: Re: conversion specifier.
Reply-To: djgpp AT delorie DOT com

Alastair Hogge <al_ AT tpg DOT com DOT au>:

> My Code:
> unsigned long foo;
> printf("%d", foo);
>
> My compiler warnings:
> ...warning: int format, long int arg (arg 2)
>
> What does this mean? Is it the "%i" thingy?

Exactly. You are printing an unsigned long int value 
using a signed integer format.

> How can make that warning vanish?

You should use the right format. In this case you can 
use "%lu" in stead of "%d", which is specific to 
unsigned long integers.

You can have a look at the printf documentation for a 
complete list of all available formats (type "info libc
alpha printf" in a dos box)

ciao
  Giacomo
-----------------------------------------------------
Giacomo Degli Esposti - pad2369 AT iperbole DOT bologna DOT it

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019