Question
My code is giving me errors output enter numbers ending with 0: 1 2 4 3 0 numbers entered by user are: 1 2 4
My code is giving me errors
output
enter numbers ending with 0: 1 2 4 3 0 numbers entered by user are: 1 2 4 3 the max(largest) number is: 4
Use pointers. Arrays cannot be used except on the main function.
#include #define N 10 void main() { int max,a[N]={0}; int getseries(*&a[N]); findmax(&a,N); } void getseries(int *p,int P) { int *q; printf("enter numbers ending with 0: "); for(q=p;q<=p+P;q++) { scanf("%d",q); if (*q=0) break; } } printf("numbers entered by user are: "); for(q=p+N+1;q<=a;q++) printf(" %d", *q); printf(" "); printf("the max number is: ",max); { int findmax() { int q, max; max=*q for(q=p;q<=p+P;q++) if(*q>max); max=*q return max; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started