C LAB‎ > ‎(Sem1) Introduction to C‎ > ‎

STRING Q2

posted Dec 3, 2010, 10:17 AM by Neil Mathew   [ updated Dec 3, 2010, 10:19 AM ]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <string.h>
 
int main ()
{
  char str[] ="This is a line";
  char *p;
  
  p = strstr (str, " ");
  puts (p);
 
  p = strchr (str, 'i');
  puts (p);
 
  p = strrchr (str, 'i');
  puts (p);
  
  return 0;
}

 OUTPUT:

 is a line
is is a line
ine
Comments