Date: Sun, 18 Mar 2001 14:38:06 -0800 (PST) From: gh@raditex.se To: freebsd-gnats-submit@FreeBSD.org Subject: misc/25904: Error in the printf-function. Message-ID: <200103182238.f2IMc6t11966@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 25904
>Category: misc
>Synopsis: Error in the printf-function.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Mar 18 14:40:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Göran Hasse
>Release: 4.2
>Organization:
Raditex AB
>Environment:
Ordinary c-program
>Description:
The printf function seems to mix up whats a pointer and whats
a value... ?
>How-To-Repeat:
Run this program
#include <stdio.h>
#include <stdlib.h>
main()
{
int * Var;
float Value;
int IntVar;
Value = 2.4;
IntVar = 4;
Var = malloc(4);
*Var = Value ;
/* Why is it like this? - explain */
if( 0 )
printf("Value is %f \n", Value );
printf(" Var is %f \n", Var );
if( 1 )
printf("Value is %f \n", Value );
printf(" Var is %f \n", Var );
*Var = IntVar;
if( 1 )
printf("Value is %d \n", IntVar );
printf(" Var is %d \n", *Var );
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103182238.f2IMc6t11966>
