Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-18-2003, 12:12 PM   #1 (permalink)
dhaas
Registered User
 
Join Date: Apr 2003
Posts: 2
dhaas is on a distinguished road
Array initialization in a class

I want to initialize all the elements in a 2-dim array to zerro in my class header file.

This works in main......

int array[24][24] = {0};

but it does not work in my header file. Why?
anyone know how to do it in the header file?
dhaas is offline   Reply With Quote
Old 04-18-2003, 12:18 PM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,696
redhead is on a distinguished road
Because you will have to declare it as exported, in the header file ie:

export int** array;

then in some C file have:

int array[24][24] = {0};

Sorry if this sound strange.. But I'm a bit drunk at the moment, and might not make that much sence.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 04-18-2003, 12:30 PM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
Quote:
Originally posted by redhead
Sorry if this sound strange.. But I'm a bit drunk at the moment, and might not make that much sence.
eheh..
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
to put data methods inside class or not? sde Java 2 05-25-2004 04:09 PM
Class Array kokkines Standard C, C++ 5 05-11-2004 01:29 AM
pointer to function with class? Kportertx Standard C, C++ 5 04-11-2003 05:12 AM


All times are GMT -8. The time now is 11:25 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting