Computer Science, asked by Kohar3207, 1 year ago

The following code appears at the start of a function. Identify the errors, if any, in the code
static int count [ ] = {10 ,15, 20, 30;
float value;

Answers

Answered by BERACAH
0

static int count[]=(10,15,20,30};

//float value=0;                    or you can declare this before operation

you forgot to write '};' at end of the array initialization



Answered by lovingheart
0

static int count [ ] = {10 ,15, 20, 30;  

float value;

In the given code there are errors to be rectified.

• The array size needs to be mentioned

• The first line needs closing braces “}”

• Since there is a static variable, the function should also be static.  

The given code can be rectified as

static int count[5] = {10,15,20,30};

float value;

The second line looks error free because it is a declaration statement that ends with a semicolon, the syntax for the declaration is also rightly defined.

Similar questions