Re: Print elements in array
u can also take the below example for java
(Toggle Plain Text)
System.out.println ( "All the values in the array are: " );
for ( T x: array1 )
System.out.println ( x );System.out.println ( "All the values <strong class="highlight">in</strong> the <strong class="highlight">array</strong> are: " );
for ( T x: array1 )
System.out.println ( x );
Change T to whatever the type of the array is. Or, if you aren't up to the latest version of Java:
(Toggle Plain Text)
System.out.println ( "All the values in the array are: " );
for ( int i = 0; i < array1.length; i++ )
System.out.println ( array1[i] );System.out.println ( "All the values <strong class="highlight">in</strong> the <strong class="highlight">array</strong> are: " );
for ( int i = 0; i < array1.length; i++ )
System.out.println ( array1[i] );
Re: Print elements in array
I think because u have used array name before declaration may be tat's why it's not working.......
coz compiler needs to have information about the array declaration..
Re: Print elements in array
Make this small change in the code.
for(d=-1;d <= (int)(TOTAL_ELEMENTS-2) ;d++)
Since Sizeof() returns unsigned int , thus it might be the problem while comparing a int with an unsigned int...
Re: Print elements in array
Hi,
Thats a right answer..