Computer Science, asked by pottapavani07, 9 months ago

dentify the error in the following C code.
1 #include<stdio.h>
2 void main() {
char arr[10]="rectangle"; //Line3
int i;
for(i=0;i<=7;i++)
printf("%d", arr[i]);
arr++; //line7
8)​

Answers

Answered by nidaeamann
0

Explanation:

The above code has several errors;

In Line 3, when we have defined a data type as char, there is no need to put that in inverted commas.

In line 5; the range of for loop should be i<=8 instead of i<=8 if the complete character is to be displayed ( that’s not a syntax error by the way)

In line 7, this is not a valid syntax, also no need to increment a character array

Similar questions