C novice here.
I am trying to write a program containing function that takes in an array pointer, and each element of the array passed in the main function is incremented by 1. This is what I have tried:
#include <stdio.h>
#include <stdint.h>
void array_incr(int8_t *, uint8_t);
int main (void){
int8_t *arr[] = {0xAB, 0xCB, 0xC4, 0x84};
array_incr(arr, sizeof(arr)/sizeof(arr[0]);
int i;
for (i = 0; i < 4; i++)
printf("%d", arr[i]);
}
void array_incr(int8_t *arr, uint8_t len){
int i;
for(i=0; i<len; i++)
arr[i]++;
}
This is compiling with a lot of warnings and errors. Could someone please tell me where I am going wrong, while maintaining the same format of implementation?