/*
Nome: Mario
Cognome: Montanari

strrchr()
*/

#include <iostream>
#include <cstring>

#define SIZE 40

using namespace std;

char *strrchr(const char *src, int c);

int main(void) {
	char src[SIZE] = "mario.montanari@studenti.itisravenna.it";
	char *ptr;
	int chr = 'a';
	
	ptr = strrchr(src, chr);
	
	cout << src << endl;
	cout << ptr << endl;
	
	return 0;
}

char *strrchr(const char *src, int c) {
	const char *ptr = nullptr;
	
	while (*src) {
		if (*src == c) {
			ptr = src;
		}
		src++;
	}
	
	return (char*)ptr;
}