From mboxrd@z Thu Jan 1 00:00:00 1970 From: "J." Subject: printf format type, precision... Date: Sat, 3 Jul 2004 00:32:27 +0200 (CEST) Sender: linux-c-programming-owner@vger.kernel.org Message-ID: Reply-To: linux-c-programming@vger.kernel.org Mime-Version: 1.0 Return-path: List-Id: Content-Type: TEXT/PLAIN; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-c-programming@vger.kernel.org Saturday, July 03 00:18:09 Hello, I am trying to convert an IP address to it's eq. in base10 [homework]. However the outcome from the formula listed below isn't giving me the right results. Is this because I'm using the wrong precision type for the `result' variable ? If that's the case what other precision type should I use instead ? Right now I can't see the format tree's trhu the precision forrest anmore .. ehum. #include int main(void) { int var1 = 192; int var2 = 168; int var3 = 1; int var4 = 10; long int result = 0; result = var1 * (256 ^ 3) + var2 * (256 ^ 2) * var3 * 256 + var4; printf("%ld\n", value); return 0; } Your comments and suggestions will be greatly appreciated.. Thnks..! J.