CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Fri, 08 Aug 2025 19:32:20 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20080327210547
location: https://web.archive.org/web/20080327210547/https://www.daniweb.com/code/snippet772.html
server-timing: captures_list;dur=0.499122, exclusion.robots;dur=0.020206, exclusion.robots.policy;dur=0.009125, esindex;dur=0.012496, cdx.remote;dur=11.172604, LoadShardBlock;dur=243.144860, PetaboxLoader3.datanode;dur=46.272784, PetaboxLoader3.resolve;dur=66.684211
x-app-server: wwwb-app216
x-ts: 302
x-tr: 281
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app216; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Fri, 08 Aug 2025 19:32:21 GMT
content-type: text/html; charset=utf-8
x-archive-orig-date: Thu, 27 Mar 2008 21:05:46 GMT
x-archive-orig-server: Apache/2.2
x-archive-orig-x-powered-by: PHP/5.1.6
x-archive-orig-set-cookie: bblastactivity=0; expires=Fri, 27-Mar-2009 21:05:46 GMT; path=/; domain=.daniweb.com
x-archive-orig-cache-control: private
x-archive-orig-pragma: private
x-archive-orig-connection: close
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Thu, 27 Mar 2008 21:05:47 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Fri, 02 Nov 2007 22:23:13 GMT", ; rel="prev memento"; datetime="Sun, 06 Jan 2008 16:03:32 GMT", ; rel="memento"; datetime="Thu, 27 Mar 2008 21:05:47 GMT", ; rel="next memento"; datetime="Wed, 30 Apr 2008 23:26:19 GMT", ; rel="last memento"; datetime="Mon, 03 Nov 2008 03:28:26 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 51_2_20080327130203_crawl102-c/51_2_20080327210435_crawl104.arc.gz
server-timing: captures_list;dur=0.722324, exclusion.robots;dur=0.023326, exclusion.robots.policy;dur=0.010867, esindex;dur=0.017026, cdx.remote;dur=154.711755, LoadShardBlock;dur=237.202892, PetaboxLoader3.datanode;dur=173.237598, PetaboxLoader3.resolve;dur=281.702416, load_resource;dur=234.972185
x-app-server: wwwb-app216
x-ts: 200
x-tr: 726
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
Reversing Singly Linked List Easily - c
Reversing Singly Linked List Easily
•
•
•
•

What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 301,562 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,693 IT professionals currently interacting right now! If you are in the IT industry or are just a technology enthusiast, you might find just what you're looking for in DaniWeb. Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Modernize Legacy Data with Sybase
void rev(node *h,node *myparentaddr) { if(h->next!=NULL) { rev(h->next,h); tail=h; } else head=h; h->next=myparentaddr; } call it in main by rev(head,NULL);
Comments (Newest First)
jessel | Newbie Poster | 29 Days Ago

•
•
•
•
hello do you have a program in c that deals in linked list?
please help me
please help me
farwa | Newbie Poster | Feb 7th, 2008

•
•
•
•
hello every one i m new to c language can any one help me in typing a marksheet in c.
Duoas | Nearly a Posting Virtuoso | Nov 9th, 2007

•
•
•
•
Nice, but it fails on three counts:
1. It doesn't return the new head of the list.
2. It fails if h is NULL.
3. It fails on really big lists (stack overflow).
Here's an iterative solution you might enjoy.
Call it thus:
Enjoy!
1. It doesn't return the new head of the list.
2. It fails if h is NULL.
3. It fails on really big lists (stack overflow).
Here's an iterative solution you might enjoy.
C Syntax (Toggle Plain Text)
/* Reverse a singly linked list without recursion. The argument may be NULL. Returns the new head of the list. Runs in linear time and with constant memory usage. */ node *rev( node *head ) { node *next; node *curr = head; node *prev = NULL; while (curr != NULL) { next = curr->next; curr->next = prev; prev = curr; curr = next; } return prev; }
head = rev( head );
Enjoy!
jai_steave | Newbie Poster | Oct 18th, 2007

•
•
•
•
it works recursively
Post Comment