how to get the last character of a string in c language

https:/‮al.www/‬utturi.com
how to get the last character of a string in c language
/*
Example: get last char string in C language
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <stdbool.h>
#include <errno.h>
#include <unistd.h>

int main()
{
    char fruit[5] = "apple";
    char lastChar = fruit[strlen(fruit)-1];
    printf("Last character : %c", lastChar );
    return 0;
}
Created Time:2017-08-28 19:27:16  Author:lautturi