#include <iostream>
typedef struct _test {
int a;
int b;
int c;
}test;
test sArray1[]=
{
{10,2,3},
{3,9,0},
{90,56,82},
{7,8,2}
};
test sArray2[]=
{
{10,12,32},
{13,99,40}
};
*//i need to initialize sArray as:*
test sArray[]={//how?. is this possible?.
sArray1
sArray2
};
int main(int argc, char* argv[])
{
*//in here be able to access sArray elements.*
return 0;
}
johans22
0
Newbie Poster
Recommended Answers
Jump to PostGood start. Your declaration/definition on line 24 should be:
test* sArray[] = {
Why, you may ask? Because naming an array by its simple name (such as sArray1 or sArray2) is actually a pointer to the array; hence, the use of the pointer type for sArray[]. IE, you have an …
All 4 Replies
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
johans22
0
Newbie Poster
Tumlee
42
Junior Poster in Training
johans22
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.