Mar 20, 2012

C Program to demonstrate how the escape characters work.

C Program to demonstrate how the escape characters work.Escape character is the single character, and it is compiled as the character constant.
Escape characters are used to solve the c format problems.
An escape sequence is denoted by using the backslash (\) as an escape character, followed by a single character indicating the nonprintable character desired.
Read more about C Programming Language .


/***********************************************************
* You can use all the programs on  www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
* 
*                      Happy Coding
***********************************************************/

   #include <stdio.h>
   #include <conio.h>
   main()
    {
      clrscr();
      printf("Escape operators");

      printf("Example program to show the escape characters:\n\n");
      printf("\t here is tab");
      printf("\n Here starts new line");
      getch();
    }
You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it


(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link

C Program to find the position of a sub string.

C Strings:
C Program to find the position of a sub string in a given string.
In this program, We find the position of a sub string where it starts  in the main string. Read more about C Programming Language .


/***********************************************************
* You can use all the programs on  www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
* 
*                      Happy Coding
***********************************************************/


#include <stdio.h>
#include <conio.h>
main()
  {
    char firststr[30], substr[10];
    char *secondstr, *thirdstr;
    clrscr();
    printf("Enter any string");
    scanf("%s",firststr); 
    printf("Enter sub string");
    scanf("%s",substr); 
    secondstr=firststr;
    thirdstr=substr;
    i=substr(secondstr, thirdstr);
    printf("\n\n");
    if(i!=-1)
      printf("The starting location/position of substring in main string: %d", i;
    else
       printf("String not found");
       getch();
   } 
  

  int substr(secondstr, thirdstr)
    
{
  char *secondstr, *thirdstr;

  int j=0,l=0;
  static int k;
    if(*second==*third)
      {
        while(i<strlen(third))
         {
           if(*second==*third)
           k=j+1;
           else
             k+=1;
             l++;
          }
  third++;
  second++;
   }
 second++;
 j++;

if(k!=0)
  return(k);
else
return(-1);
} 
Read more Similar C Programs
Searching in C

C Strings

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it


(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!


To browse more C Programs visit this link