Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: c++ code question

Author: Russell Reagan

Date: 18:51:05 11/24/03

Go up one level in this thread


On November 24, 2003 at 21:39:56, macaroni wrote:

Some comments below.

>#include <iostream.h>

iostream.h is not a standard header. This is not a big deal, but it is probably
better to #include <iostream> and use the std namespace.

>struct test
>{
> public:

You don't need public there. The default access for a struct is public.

> int test2,test3;
>};
>
>int main()
>{
> test test1;
> test1.test2=1;
> test1.test3=2;
> test* pointer_to_test1;
> pointer_to_test1=&test1;
> (*pointer_to_test1.test2)=3;

This should be:
  (*pointer_to_test1).test2 = 3; // or
  pointer_to_test1->test2   = 3;



This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.