Connecting Tech Pros Worldwide Forums | Help | Site Map

Few Questions (HW questions already answered by me)

padh.ayo@gmail.com
Guest
 
Posts: n/a
#1: Dec 5 '06
Hi, I just have a few questions maybe you guys can verify for
correctness:
..
------------------------------------------------------------------------------------------------------------------------

21) Show how you would insert a new element "new_element" into a
linked list "my_list"

my_list new_element = my_list->next;

------------------------------------------------------------------------------------------------------------------------

Just for MY verification: If you want to create a link list in C, do
you need a structure all the time? I know how to create it that way,
but just curious if there are any other ways.

Thanks..


Ben Pfaff
Guest
 
Posts: n/a
#2: Dec 5 '06

re: Few Questions (HW questions already answered by me)


padh.ayo@gmail.com writes:
Quote:
Hi, I just have a few questions maybe you guys can verify for
correctness:
.
>
21) Show how you would insert a new element "new_element" into a
linked list "my_list"
>
my_list new_element = my_list->next;
That doesn't insert anything into anything. It's just an
initialization. Presumably my_list is a pointer type.
Quote:
Just for MY verification: If you want to create a link list in C, do
you need a structure all the time? I know how to create it that way,
but just curious if there are any other ways.
Normally a linked list will include some kind of auxiliary data
in each node, in addition to the linked list pointers themselves.
The way C provides to bind together different types of data items
in a single package is to use a structure.

Other ways may be possible, but they'd probably be much more
awkward. For example, I suppose you could use an array of two or
more pointers to form a linked list node, but it wouldn't
normally be sensible to do so. (I could see a Lisp
implementation in C might want to do that, but even then it might
be better to use a structure.)
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Harald van Dijk
Guest
 
Posts: n/a
#3: Dec 5 '06

re: Few Questions (HW questions already answered by me)


padh.ayo@gmail.com wrote:
Quote:
Hi, I just have a few questions maybe you guys can verify for
correctness:
.
------------------------------------------------------------------------------------------------------------------------
>
21) Show how you would insert a new element "new_element" into a
linked list "my_list"
>
my_list new_element = my_list->next;
>
------------------------------------------------------------------------------------------------------------------------
Are you sure that is the correct answer?
Quote:
Just for MY verification: If you want to create a link list in C, do
you need a structure all the time? I know how to create it that way,
but just curious if there are any other ways.
There are other ways, but they amount to the same thing. For example,
if your elements are a bunch of pointers, instead of a structure
containing a pointer to the next element and the data pointer, you
could use an array of two pointers, instead of element->next use
element[0], and instead of element->data use element[1]. It would not
be more readable, it would not be more efficient, it would not be a
good idea. But it's possible.

bogdan
Guest
 
Posts: n/a
#4: Dec 6 '06

re: Few Questions (HW questions already answered by me)



"""padh.ayo@gmail.com ÐÉÓÁÌ(Á):
"""
Quote:
Hi, I just have a few questions maybe you guys can verify for
correctness:
.
------------------------------------------------------------------------------------------------------------------------
>
21) Show how you would insert a new element "new_element" into a
linked list "my_list"
>
my_list new_element = my_list->next;
>
------------------------------------------------------------------------------------------------------------------------
>
Just for MY verification: If you want to create a link list in C, do
you need a structure all the time? I know how to create it that way,
but just curious if there are any other ways.
>
Thanks..



http://magegame.ru/?rf=626f6764616e

bogdan
Guest
 
Posts: n/a
#5: Dec 6 '06

re: Few Questions (HW questions already answered by me)




On 6 äÅË., 02:39, padh....@gmail.com wrote:
Quote:
Hi, I just have a few questions maybe you guys can verify for
correctness:
.
-------------------------------------------------------------------------------------------------------------------------
>
21) Show how you would insert a new element "new_element" into a
linked list "my_list"
>
my_list new_element = my_list->next;
>
-------------------------------------------------------------------------------------------------------------------------
>
Just for MY verification: If you want to create a link list in C, do
you need a structure all the time? I know how to create it that way,
but just curious if there are any other ways.
>
Thanks..
http://magegame.ru/?rf=626f6764616e

Ben Pfaff
Guest
 
Posts: n/a
#6: Dec 6 '06

re: Few Questions (HW questions already answered by me)


"bogdan" <bogdan@birulevo.netwrites:
That page appears to be blank.
--
Ben Pfaff
email: blp@cs.stanford.edu
web: http://benpfaff.org
pete
Guest
 
Posts: n/a
#7: Dec 6 '06

re: Few Questions (HW questions already answered by me)


Ben Pfaff wrote:
Quote:
>
"bogdan" <bogdan@birulevo.netwrites:
>>
That page appears to be blank.
In my browser,
it looks like ululations with a Portuguese accent.

--
pete
jaysome
Guest
 
Posts: n/a
#8: Dec 6 '06

re: Few Questions (HW questions already answered by me)


On Tue, 05 Dec 2006 17:24:24 -0800, Ben Pfaff <blp@cs.stanford.edu>
wrote:
Quote:
>"bogdan" <bogdan@birulevo.netwrites:
>>
>That page appears to be blank.
It appears in IE7 under Windows XP. The character encoding is
"Cyrillic (Windows)". There's a graphic of two "Cyrillic" men on the
page, and some input fields for what looks like a username and
password. There is nothing about C at all.

--
jay
Christopher Benson-Manica
Guest
 
Posts: n/a
#9: Dec 6 '06

re: Few Questions (HW questions already answered by me)


Ben Pfaff <blp@cs.stanford.eduwrote:
Quote:
"bogdan" <bogdan@birulevo.netwrites:
Quote:
That page appears to be blank.
"bogdan" has made at least three other identical contentless posts to
the group, so it is clearly just another spammer.

--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
santosh
Guest
 
Posts: n/a
#10: Dec 6 '06

re: Few Questions (HW questions already answered by me)


Ben Pfaff wrote:
Quote:
"bogdan" <bogdan@birulevo.netwrites:
>>
That page appears to be blank.
He's already spammed this group with that exact post about ten times
already.

jjds101@yahoo.com
Guest
 
Posts: n/a
#11: Dec 6 '06

re: Few Questions (HW questions already answered by me)



Christopher Benson-Manica wrote:
Quote:
Ben Pfaff <blp@cs.stanford.eduwrote:
>
Quote:
"bogdan" <bogdan@birulevo.netwrites:
>>
Quote:
That page appears to be blank.
>
"bogdan" has made at least three other identical contentless posts to
the group, so it is clearly just another spammer.
Looks like it worked too, considering at least 3 people say they've
clicked on the link...

Closed Thread