| | |
Size
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
>>static int b[SIZE]={0,2,4,6,8};
SIZE = 4; b[SIZE] has 5 elements - not good
>>int x[SIZE-5];
SIZE-5 = -1. You cannot declare an array with negative dimention.
Also, int main () , not void main ().
And, for defining the size of an array, I prefer #define SIZE X instead const int SIZE=X,
SIZE = 4; b[SIZE] has 5 elements - not good
>>int x[SIZE-5];
SIZE-5 = -1. You cannot declare an array with negative dimention.
Also, int main () , not void main ().
And, for defining the size of an array, I prefer #define SIZE X instead const int SIZE=X,
Last edited by frrossk; Nov 29th, 2004 at 4:56 am. Reason: forgetting something
•
•
Join Date: Jul 2004
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Faramba
Are the following array declarations valid, if not why?: "i'm confused!"
const int SIZE=4;
void main()
{
int a[SIZE]= {0,2,4,6}; ---------------(1)
static int b[SIZE]={0,2,4,6,8};
int x[SIZE-5];
int d[SIZE*2];
. . .
. . .
}
You can re-write the statement (1) as follows:
int a[] = {0,2,4,6};
void main()
{
...
}
![]() |
Similar Threads
- "Open new window" Window Size - how to change? (Web Browsers)
- Change Web Page Font Size on the Fly (Windows tips 'n' tweaks)
- Any advice about folder size viewer (Windows NT / 2000 / XP)
- AGP Aperture Size Question (Windows NT / 2000 / XP)
- Size limit notification in outlook 2000 (Windows NT / 2000 / XP)
- window size keeps changing (Windows 95 / 98 / Me)
- can't find file size over 3 megabytes to clean up harddrive (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: Really Weird Error... Fibonacci Nums
- Next Thread: Can any1 tell me whatz wrong in this program...this does not show the output!!!
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






