marq

Dr. Charles Simonyi is the Father of Modern Microsoft Excel                                           JavaScript was originally developed by Brendan Eich of Netscape under the name Mocha, later LiveScript, and finally renamed to JavaScript.                                           The word "Biology" is firstly used by Lamarck and Treviranus                                           Hippocrates (460-370 bc) is known as father of medicine.                                           Galene, 130-200 is known as father of Experimental Physology                                           Aristotle (384-322 BC) is known as Father of Zoology because he wrote the construction and behavior of different animals in his book "Historia animalium"                                           Theophrastus(370-285 BC) is known as father of Botany because he wrote about 500 different plants in his book "Historia Plantarum".                                           John Resig is known as Father of Jquery -                                          HTML is a markup language which is use to design web pages. It was invented in 1990 by Tim Berners-Lee.                                                                The Google was founded by Larry Page and Sergey Brin.                                                                Rasmus Lerdorf was the original creator of PHP. It was first released in 1995.                                                               Facebook was founded by Mark Zuckerberg                                                               Bjarne Stroustrup, creator of C++.                                                                Dennis Ritchie creator of C                                                                                                                              James Gosling, also known as the "Father of Java"                                          At 11.44%, Bihar is India's fastest growing state                                          Father of HTML -Tim Berners Lee                                          orkut was created by Orkut Büyükkökten, a Turkish software engineer                    Photoshop: It came about after Thomas Knoll, a PhD student at the University of Michigan created a program to display grayscale images on a monochrome monitor which at the time was called 'Display'.

String

The way a group of integers can be stored in an integer array, a group of characters can also be stored in character array. An array of characters in often called a string. Character arrays are used by programming languages to manipulate text such as words and sentences.

A string constant is a one-dimensional array of characters terminated by a null ('\0') character. The terminating null ('\0') is important, because it is the only way the function that works with string can know where a strings ends. In fact, a string not terminated by a '\0' is not really a string, but merely a collection of characters.


Representation  of strings 
A string can be represented using an array or a linked list. A String of characters having length n can be implemented by a one dimensional array of n elements where the i th element of the array stores the i th character  of the string. The advantage of such a representation is that the array elements can be directly accessed and this could speed up several operations on strings.   

#include<stdio.h>
#include<conio.h>
#include<string.h>


int xstrlen(char*);
void xstrcpy(char*,char*);
void xstrcat(char*,char*);
int xstrcmp(char*,char*);
void show (char*);


void main()
{

char s1[ ]="Kicit";
char s2[ ]="Nagpur";
char s3[20];
int len;

clrscr();
printf("String S1:%s\n",s1);
len=xstrlen(s1);
printf("Length of string s1:%d\n",len);
printf("String s2: %s \n",s2);

xstrcpy(s3,s1);
printf("String s3 after concatenation : %s \n",s3);

if(xstrcmp (s1,s2)==0)
   printf("The strings s1 and s2 are similar \n");
else
printf("The  string s1 an s2 are not similar \n");

getch();
}

/* copies source string s to target string t*/
void xstrcpy (char *t, char *s)
{
while (*s)
{
*t=*s;
t++;
s++;
}
*t='\0';
}


/*find the length of the string */
int xstrlen(char *s)
{
int l=0;
while (*s)
{
l++;
s++;
}
return l;
}

/*  concatenate  the two strings*/
void xstrcat (char *t, char *s)
{
while(*t)
 t++;
 while(*s)
 *t++=*s++;
*t='\0';
}


/* compares two strings s and to for equality*/

int xstrcmp (char *t, char *s)
{
  while (*s==*t)
{
if(!(*s))
 return 0;
s++;
t++;
}
return(*s-*t);
}

No comments:

Post a Comment