Sub String In C Programming Tamil


#include<stdio.h>
#include<conio.h>
char *sub(char *,int,int);
void main()
{
	int s,c;
	char *a;
	clrscr();
	printf("\nEnter the string :");
	gets(a);
	printf("\nEnter the start position :");
	scanf("%d",&s);
	s=s-1;
	printf("\nEnter the no of characters from start position :");
	scanf("%d",&c);
	printf("\nSubstring : %s",sub(a,s,c));
	getch();
}
char *sub(char *a,int s,int c)
{
	int i=0,j=0;
	char *b;
	while(a[i]!='\0')
	{
		if(i>=s&&j<=c)
		{
		   b[j]=a[i];
		   j++;
		}
		i++;
	}
	b[j]='\0';
	return b;
}

Login To Download Source Code

Leave a Comment:

Login To Comment

List Of Programs


Goto Examples

Operators

Looping

Number Conversion

Pattern Design

Arrays

Matrix Examples

Sorting Examples

String Function

Change Case

String In C

Maths Functions

User Defined Functions

Recursive Functions

Pointer

Structure

File Concept

Calender Programming