Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 29th, 2007, 04:13 PM
Registered User
Join Date: Dec 2007
Location: salzburg, , Austria.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default pointer to struct

Please help me!
I have the problem of rare using of c language.

in deklaration part i have defined a struct:
define NBR = 10;
typedef struct {char *name; int nr} Testtype;

in main programm i will point to Testtype (and this should be an array of NBR, but this is my problem). i did:
Testtype t_type = {"sdfsdf", 10};
Testtype *test_type = t_type;

So far so good, but who i could predefine my other (up to NBR) structs?,
thanks for helping, go.

Reply With Quote
  #2 (permalink)  
Old January 10th, 2008, 07:23 AM
Registered User
Join Date: Jan 2008
Location: , , Ukraine.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to ScorpZ


Testtype *test_type = t_type;

It's mistake.!
 You must initialize pointer by -
1) other pointer
3) object's address

for example

Testtype *test_type = &t_type;

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me - fill dataGridView from struct array ranjithemail C++ Programming 0 May 10th, 2008 11:53 PM
Dynamic array of struct bobwrx C# 2 September 14th, 2006 06:12 AM
class and struct variables are confusing webworldman C# 2 August 7th, 2006 03:42 AM

All times are GMT -4. The time now is 01:47 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.