OT: Cecko a pointry

Ferdinand Prantl Ferdinand.Prantl na ff.cuni.cz
Úterý Únor 8 14:39:50 CET 2000


On Tue, Feb 08, 2000 at 02:34:00PM +0100, Martin Trcka wrote:
> Prominte za OT.
> 
> ucim se cecko, konkretne ted jsem zrovna u pointeru. Podle knizky
> P.Herouta by mel byt nasledujici programek funkcni a mel by
> vypsat vetsi ze dvou cisel. Po spusteni mi to jakoby porad stoji na
> cteni tech dvou cisel, nic nevytiskne.
> 
> #include <stdio.h>
> 
> main()
> {
> int i,j, *p_i;
> 
> scanf("%d %d",&i,&j);
> p_i = ( i > j ) ? &i : &j;
> printf("Vetsi je %d \n",*p_i);
> }
> 

  funguje to :

# vi test.c
# gcc -o test test.c 
# ./test 
12 23
Vetsi je 23 
# 

  Ferda Prantl

-- 

   "Jen ve svych snech jsme svobodni. Po zbytek zivota potrebujeme penize."
----------------------------------
Ferdinand Prantl
LVT FF UK
e-mail: prantl na ff.cuni.cz
www: http://www.ff.cuni.cz/~prantl
ICQ: 36302930


Další informace o konferenci Linux