Debug C language int element(int arr[], int num) { in i, ele; ele = arr[0]; for (i = 1; i < num; i++) if (arr[i] > ele) ele = arr[i]; return ele; } main() { arr[] = {1, 24, 145, 20, 8, -101, 300}; int n = sizeof(arr)/sizeof(arr[0]); printf("element of array is %d", element(arr[], n)); }

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter3: Understanding Structure
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question

Debug C language

int element(int arr[], int num)

{

in i, ele;

ele = arr[0];

for (i = 1; i < num; i++)

if (arr[i] > ele)

ele = arr[i];

return ele;

}

main()

{

arr[] = {1, 24, 145, 20, 8, -101, 300};

int n = sizeof(arr)/sizeof(arr[0]);

printf("element of array is %d", element(arr[], n));

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of memory addresses in pointers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning