Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
sp2014e4
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//fpc 2.6.2 program HelloWorld; type Lista = ^Celda; Celda = record dato: integer; sig: Lista; end; procedure insertarOrdenado (elem: integer; var list: Lista); var actual, anterior, nuevo : Lista; begin if list=nil then begin new(list); list^.dato:=elem; list^.sig:=nil; end else begin actual:=list; anterior:=nil; while (actual<>nil) and (actual^.dato<=elem) do begin anterior:=actual; actual:=actual^.sig; end; new(nuevo); nuevo^.dato:=elem; nuevo^.sig:=actual; if anterior = nil then list:=nuevo else anterior^.sig:=nuevo; end; end; var list : lista; begin list:=nil; new(list); new(list^.sig); new(list^.sig^.sig); list^.dato:=1; list^.sig^.dato:=3; list^.sig^.sig^.dato:=6; insertarOrdenado(4,list); //writeln(list^.dato); writeln(list^.dato,',',list^.sig^.dato,',',list^.sig^.sig^.dato,',',list^.sig^.sig^.sig^.dato); end.
Show compiler warnings
[
+
]
Show input
edit mode
|
history
|
discussion
stackse - search stackoverflow differently