Download presentation
Presentation is loading. Please wait.
1
Arrays & pointers C How to Program, 8/e
4
How arrays work
5
How arrays work
7
Strings in C
8
Strlen and sizeof
9
Introducing pointers
12
Passing function arguments
14
What's the output of this code?
17
What happens when you run this?
19
Pointers VS Arrays
20
#include <stdio.h>
int largest(int* ,int); int largest(int* arr,int num) { int largest=*arr; int i; for (i=1;i<num;i++) // if (a[i] > largest) if (*(arr+i) > largest) //largest=arr[i]; largest=*(arr+i); } return largest; int main() int a[10]; for (i=0; i< 10; i++) printf("Enter a number: "); scanf("%d",&a[i]); // printf("The largest: %d\n",largest(&a[0],10)); printf("The largest: %d\n",largest(a,10)); return 0;
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.