Error Question

I have an exam 2mmoro. Just saw this question in the last years paper. Just wanted to know whats the answer...

Rewrite the following program after correcting all the syntax errors.
1
2
3
4
5
6
7
8
9
 #include<iostream.h> 
       void main()
       {  char ch;
          #define max 10
          int a[5][]={ 10,20,30 };
          cin>>ch;
          ch=tolower(ch);
          cout<<++max;
       }   
Can you see any syntax errors yourself? You can run this in a compiler and read the errors. Could you show us some of the progress you've done on this one?
Last edited on
Actually my C++ was a trial version and just got over & exam is 2mmoro... :(

int a[5][]={ 10,20,30 };


This initialization is wrong right??
When 2 dimensional arrays are initialized in unsized manner, only the 1st index value can be skiped, however the 2nd index must be given. So can it be written this way....

int a[][3]={ 10,20,30 };
Last edited on
Topic archived. No new replies allowed.