• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

how to create array using linked list....

 
Ranch Hand
Posts: 1143
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to know how do i create linked list using array, and how can i create array using linked list???
with example...
 
author
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Punit Jain wrote:i want to know how do i create linked list using array, and how can i create array using linked list???
with example...



Creating a linked list from an array is straightforward:



Creating an array from a linked list is less so --- you need to dynamically allocate your array and copy in the data:



Using dynamic arrays is generally a bad idea though. It's better just to use std::vector instead, which manages the memory for you automatically.
 
Punit Jain
Ranch Hand
Posts: 1143
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you suggest me any good book for c and c++??
 
Anthony Aj Williams
author
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Punit Jain wrote:can you suggest me any good book for c and c++??



For C++ I would recommend "Accelerated C++" by Koenig and Moo. I can't think of a good introductory book for C, and I'm inclined to say that it's not worth learning C separately until you really need to, as good C idioms are quite different from good C++ idioms, and learning both will lead to confusion, and make your C++ worse.
 
Saloon Keeper
Posts: 14010
315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree, don't mess around with C unless you have to. It's an old low level language that may stand in the way of your learning process at this time.

If you do decide to learn it, the absolute best thing you can read is Kernighan and Ritchie's "The C Programming Language". I believe you can download it as a PDF.
 
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I agree, don't mess around with C unless you have to. It's an old low level language that may stand in the way of your learning process at this time.



If you are trying to learn OO programming, then C is not a good choice. Go with C++.

I don't agree that C is a low level language though, but that's just me ;). I started with C in the late '80s & used it solidly for almost 20 years. Now I am pretty much just doing Java. C gives you the freedom to do pretty much what you want programmatically. You are not bound by contracts or "save me from myself" issues the compiler tries to enforce as with Java.

I still prefer C and have a coding style that mimics OO which has evolved over the years.

As for books, I can't recommend a modern publication for C, but for C++ the book by the man himself - Stroustrup, The C++ Programming Language 3rd edition (don't know if a later version has been published) is pretty good.

Hope that helps.
- Doug

-- Nothing is impossible if ImPossible
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic