pointers exercises

Dec 30, 2014 at 3:32pm
can someone give me exercises on pointers?
or give me a link
i was implementing my game with pointers but i dont know when or where to put pointers so i think i need to practice , i havent wrote a program using pointers since i learned pointers
Dec 30, 2014 at 5:41pm
Here you go. Exercises from C++ Primer Plus by Stephen Prata.

1. Someone runs a pizza analysis service. for each pizza, he needs to record the following information.
- name, which can consist more than one word
- diameter
- weight
devise a dynamic structure with new and write a program that uses a pointers to structure element. The program should ask the user to enter each of the preceding items (as following: diameter, name and weight) and then display that information. Use cin (or its methods) and cout.

2. design a structure called cars with following informations: make, as a string object or char array, and the year it was built as an integer. Write a program that asks the user how many cars to catalog. the program then should create a dynamic array of that many car structures. next it should prompt the user to input all the data for all cars he wanted to catalog. Then displays the data.
Dec 30, 2014 at 5:44pm
Implement a doubly-linked list (not a singly-linked list). Once you do that you can confidently say that you know pointers. At least that's what I did before I could fully comprehend pointers.
Last edited on Dec 30, 2014 at 5:45pm
Jan 2, 2015 at 9:12am
@tobruk thanks, i will do it, i just red your reply.
well i havent learned dynamic memory yet
Last edited on Jan 2, 2015 at 9:16am
Jan 2, 2015 at 9:13am
@benbalach
okay i will have some research for that
Jan 2, 2015 at 11:39am
well i havent learned dynamic memory yet
Managing dynamic memory is main purpose of pointers (second is to be mutable non-owning references to objects).
Jan 3, 2015 at 9:51am
@MiiNiPaa
second is to be mutable non-owning references to objects

okay.i will
Topic archived. No new replies allowed.