473,657 Members | 2,493 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I declare a static array in a structure

montzter
15 New Member
Hello,

can somebody suggest any alternative of the code below?
I want the values in the array to be flexible as much as I can.
/*************** *************** *************** ****/

typedef struct
{
static char* SomethingToStor e[]={
(ByteType*)"som etext here",
(ByteType*)"som etext here",
(ByteType*)"som etext here",
(ByteType*)"som etext here",
(ByteType*)"som etext here"
};

static char* AnotherSomethin gToStore[]={
(ByteType*)"som etext here",
(ByteType*)"som etext here",
(ByteType*)"som etext here",
(ByteType*)"som etext here",
(ByteType*)"som etext here"
};

} endOfStruct;
/*************** *************** *************** ***/

I can make this work if I will declare this outside a structure or as a global variable.

Thanks for the help.
Aug 30 '06 #1
1 3328
Banfa
9,065 Recognized Expert Moderator Expert
Why would you want to declare a static array in a structure, I can think of no situation where this would be useful.
Aug 30 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2068
by: mosfet | last post by:
Hi, I have some problems to write my class : if I put the structure declaration before my class i have a compiler error since my CHTTPServerCe is not yet known from the compiler but if I put it after I have another error because inside my class I use my structure (CloseConnection(LPREQUEST lpreq)). So how can I solve this problem /*--------------------------------------------------------------------------
2
3493
by: Mackan | last post by:
Hi! I'm trying to declare a structure that will be including pointers to functions. These structures in turn will be pointed to in an array and depending on a index value that specific function in the structure pointed to by the index will be called with various data. Say i have a couple of functions: int func1(int , int);
1
6972
by: Richard A. Lowe | last post by:
I'm successfully using SendInput to emulate mouse events for a legacy app, delcared like so: public extern static int SendInput( int theCount, ref INPUT pInputs, int theSize ); From the MSDN docs, SendInput appears to take an array of inputs:
8
14469
by: John Dann | last post by:
Trying to declare a structure that will contain a couple of fixed-size arrays. I'm trying eg: Structure IndexRecord Dim testarray(16) as Byte etc End Structure But vb.net is refusing to let me do this saying that I can't declare a structure with fixed size arrays. Yet the book I'm looking at shows
8
10159
by: redefined.horizons | last post by:
I would like to have an array declaration where the size of the array is dependent on a variable. Something like this: /* Store the desired size of the array in a variable named "array_size". */ unsigned short int array_size = 25; /*Declare an array named "numbers" using the variable initialized above. */ unsigned short int numbers;
3
20867
by: johnmmcparland | last post by:
Hi all, I would like to have a static constant array inside a class definition which would contain the number of days in each month (I am writing a Date class as an exercise). However my attempts so far have been unsuccessful. Take this Test class as an example // test.hpp
1
2126
by: peary | last post by:
Hi, everyone, I'm writing a program to discover wireless network using Windows Native Wifi API & VB.net. I have to declare the windows API in my VB.net program. The original windows declaration is as below. The problem is in "struct _WLAN_AVAILABLE_NETWORK_LIST", it declared "WLAN_AVAILABLE_NETWORK Network;". I think which means a Network array of struct WLAN_AVAILABLE_NETWORK.
27
5500
by: arkmancn | last post by:
Any comments? thanks. Jim
10
2472
by: Tammy | last post by:
Hello all, I am wondering what is the best way to declare a struct to be used in other c and c++ files. Such as for a C API that will be used by others. 1. Declaring the typedef and the struct in the header file and including this file in all source files that need it? For example: mystruct.h
0
8421
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.