0
Why is my code not working
Array practice https://code.sololearn.com/cO91iJpoqVDp/?ref=app
7 Answers
+ 6
Line 4:
int arr[7] = {7,1,14,11,6,21,32};
Line 10:
if (arr[i] > large)
Line 15:
printf ("large: %d\n", large );
+ 5
There are a few syntax and logic errors in your code...
Syntax
- At line 4 when initialising the array you put the [7] on the wrong side of the assignment (=), should be after the array name
- At line 15 when you print out the largest number you forgot a semi-colon (;)
- On the same line you tried to put a new line but put in the wrong slash should be \n not /n
Logic
- When checking if the array element is larger than the previous largest number you put in a less than symbol (<) which will give you the opposite effect change that to greater than (>)
I made the changes here among other non-essential ones:
https://code.sololearn.com/c5WxXN8HAQ0W/?ref=app
+ 4
Because you declare in bad way an array and you forget a semicolon after printf call
+ 3
TurtleShell Roneel Ipang KrOW thanks for the help. I'm pretty new to c programming and I'm trying to not just make functional code, but also learn the logic as well. Thanks again đ
+ 1
TurtleShell still you forgot large - largest in line 15
+ 1
Roneel ohh didnât see that, thank you
0
What way is best ? I'm new to c programming.