I am looking at these two scripts and was wondering what would the list look like in each?
int main()
{
int i;
int rV = 0;
List l = NULL;
char* input[] = { "06", "24", "3" };
sNode *s, *t;
for( i=0; i<3; ++i )
{
t = (sNode*)malloc( sizeof( sNode ));
if( t == NULL )
{
fprintf( stderr, "Couldn't get memory for a node! Exiting." );
rV = 1;
break;
}
t->data = input;
t->next = l;
l = t;
}
/* What does this list look like here? */
s = l;
while( s != NULL )
{
t = s->next;
free( s );
s = t;
}
return rV;
}
import sys
main( args=sys.argc ) :
L = [24, None]
t = [13, None]
t[1] = L
L = t
t = [28, None]
t[1] = L[1]
L[1] = t
t = [3, None]
p = L
while p != None :
q = p
p = p[1]
if p == L :
L = t
else :
q[1] = t
print L