Otra forma de implementarlo sin vectores. Gracias a la magia de los punteros:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
struct Eslabon
{
int N;
Eslabon* Anterior;
};
int main()
{
Eslabon
* Numero
= (Eslabon
*)malloc(sizeof(Eslabon
)); ...........................................................
[/quote]
amchacon ¿has usado algún modo especial al compilar. porque me saltan múltiples errores y en modo no pedantic?:|8|error: expected specifier-qualifier-list before 'Eslabon'|
||In function 'main':|ntitled38.
|12|error: 'Eslabon' undeclared (first use in this function)|
12|error: (Each undeclared identifier is reported only once|
|12|error: for each function it appears in.)|
|12|error: 'Numero' undeclared (first use in this function)|
|12|error: expected expression before ')' token|
|13|error: 'Buffer' undeclared (first use in this function)|
|28|error: expected expression before ')' token|
||=== Build finished: 8 errors, 0 warnings (0 minutes, 0 seconds) ===|
Y rn PellesC:
Building 0.obj.
\0.c(8): error #2001: Syntax error: expected '}' but found 'Eslabon'.
\0.c(9): error #2156: Unrecognized declaration.
\0.c(12): error #2048: Undeclared identifier 'Eslabon'.
0.c(12): error #2048: Undeclared identifier 'Numero'.
\0.c(12): error #2039: Illegal expression.
\0.c(12): error #2001: Syntax error: expected ')' but found 'malloc'.
\0.c(12): error #2088: Lvalue required.
\0.c(12): error #2001: Syntax error: expected ';' but found 'malloc'.
\0.c(13): error #2048: Undeclared identifier 'Buffer'.
\0.c(18): error #2112: Left operand of '->' has incompatible type 'int'.
\0.c(18): error #2168: Operands of '=' have incompatible types 'int' and 'void *'.
0.c(23): error #2112: Left operand of '->' has incompatible type 'int'.
\0.c(25): error #2112: Left operand of '->' has incompatible type 'int'.
\0.c(28): error #2039: Illegal expression.
C\0.c(28): error #2001: Syntax error: expected ')' but found 'malloc'.
\0.c(28): error #2001: Syntax error: expected ';' but found 'malloc'.
\0.c(29): error #2112: Left operand of '->' has incompatible type 'int'.
\0.c(31): error #2112: Left operand of '->' has incompatible type 'int'.
\0.c(35): error #2112: Left operand of '->' has incompatible type 'int'.
\0.c(37): error #2112: Left operand of '->' has incompatible type 'int'.
\0.c(37): error #2168: Operands of '!=' have incompatible types 'int' and 'void *'.
0.c(39): error #2112: Left operand of '->' has incompatible type 'int'.
\0.c(40): error #2112: Left operand of '->' has incompatible type 'int'.
*** Error code: 1 ***
Done.
Saluditos".