Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Python Programs
    • Java Programs
    • SQL FAQ’s

C strrchr Function

by suresh

The C strrchr function is a String Function, which returns a pointer to the last occurrence of a character in a given string. The syntax of the strrchr in C Programming language is

void *strrchr(const char *str, const char *chr_to_look);
  • str: A valid string
  • chr_to_look: Character value that you want to look inside str

strrchr in C Language Example

The strrchr function used to find the last occurrence of a character within the user-specified string.

This program will help you to understand the strrchr with multiple C Programming examples.

TIP: You have to include the #include<string.h> header before using this strrchr String Function.

/* C strrchr Function example */
 
#include <stdio.h> 
#include<string.h>

int main()
{
    char str[] =  "This is abc working in abc company";
    char *ch;
    
    ch = strrchr(str, 'b');
    
    if(ch)
    {
        printf("We Found your Last Occurence of a Given Character");
        printf("\nThe Final String From 'b' is : %s \n", ch);
    }
    else
    {
        printf("Given Character is Not found. Sorry!! \n");
    }
    return 0;
}

OUTPUT

C strrchr function example

Placed Under: C Programming

  • C Comments
  • C Escape Sequence
  • C Programming Operators
  • C Arithmetic Operators
  • C Assignment Operators
  • C Bitwise Operators
  • C Conditional Operator
  • C Increment & Decrement Optr
  • C Logical Operators
  • C Relational Operators
  • C Sizeof Operator
  • C If Statement
  • C IF ELSE Statement
  • C Else If Statement
  • C Nested If
  • C Break Statement
  • C Continue Statement
  • C Goto Statement
  • C Switch Case
  • C For Loop
  • C While Loop
  • C Do While Loop
  • C Arrays
  • C Two Dimensional Array
  • C Multi Dimensional Array
  • C String
  • C Structures
  • C Nested Structures
  • C Array of Structures
  • C Structures and Functions
  • C Union
  • C Structure & Union differences
  • C Pointers
  • C Pass Pointers to Functions
  • C GETS
  • C fgets Function
  • C fgetc
  • C fputs function
  • C fputc
  • C Functions
  • C Types of Functions
  • C Pass Array to Functions
  • Call By Value & Call By Reference
  • C Recursion
  • C Program Examples
  • C Tutorial
  • C# Tutorial
  • Java Tutorial
  • JavaScript Tutorial
  • Python Tutorial
  • MySQL Tutorial
  • SQL Server Tutorial
  • R Tutorial
  • Power BI Tutorial
  • Tableau Tutorial
  • SSIS Tutorial
  • SSRS Tutorial
  • Informatica Tutorial
  • Talend Tutorial
  • C Programs
  • C++ Programs
  • Java Programs
  • Python Programs
  • MDX Tutorial
  • SSAS Tutorial
  • QlikView Tutorial

Copyright © 2021 | Tutorial Gateway· All Rights Reserved by Suresh

Home | About Us | Contact Us | Privacy Policy