It showing the error

please look into this.

Mistakes

  1. you should have to pass i as 0 from main like
    alloccurences(arr, 0, n, key);

  2. cout<< alloccurences(arr, 0, n, key);
    this is wrong because alloccurences is void function so it doesn’t return anything hence why cout ??
    remove cout

all changes are done in below code

Modified Code

if you want to ask something about this feel free to ask
i hope this helps
if yes show your response with :heart: and don’t forgot to mark doubt as resolved