ARRAY
ARRAY
Ascending order
a11 a12 a13 a14 a15 a16 a17
a21 a22 a23 a24 a25 a26 a27
a31 a32 a33
a41 a42
Strings
Declaring and initializing of string variables
puts function
String handling function
• The Library function in the header file string.h
are Used to carry out string manipulations.
strlen()
this function is used to find out number of
character in the given string ie lenth of string .the
syntax is
strcat()
Example- strcat()
Example- strcat()
Input “lion” “tiger”
Output second string is greater than the first
Example- strrev()
Program to copy a string into another
without string function
#include<stdio.h>
main()
{
char s1[10],s2[10];
Int i=0;
printf(“enter the string to be copiedn”);
scanf(“%s”,s1);
while(s1[i]!=‘0’)
{
s2[i]=s1[i];
i++;
}
s2[++i]=‘0’;
puts(s2);
}
Program to reverse a string without string
function
#include<stdio.h>
main()
{
char s1[10],s2[10];
int L=0;
printf(“enter the string to be reversedn”);
scanf(“%s”,s1);
while(s1(L) != ‘0’)
L++;
j=L;
for(i=0;i<L;i++)
{
j--;
s2[j]=s1[i];
}
s2[L]=‘0’;
puts(s2);
}
Program to concatenate two string without
string function
#include<stdio.h>
main()
{
char s1[10],s2[10];
int L,I,j;
printf(“enter two strings to be concatenatedn”);
scanf(“%s%s”,s1,s2);
while(s1(L) != ‘0’)
L++;
i=L;
i=0;
while(s2[i]!=‘0’)
{
s1[j]=s2[i];
j++;
i++;
}
s1[++j]=‘0’;
puts(s2);
}
array unit 1 and strings     fffff .pptx
array unit 1 and strings     fffff .pptx
array unit 1 and strings     fffff .pptx
array unit 1 and strings     fffff .pptx
array unit 1 and strings     fffff .pptx
array unit 1 and strings     fffff .pptx
array unit 1 and strings     fffff .pptx
array unit 1 and strings     fffff .pptx
array unit 1 and strings     fffff .pptx
array unit 1 and strings     fffff .pptx
array unit 1 and strings     fffff .pptx

array unit 1 and strings fffff .pptx

  • 1.
  • 4.
  • 15.
  • 17.
    a11 a12 a13a14 a15 a16 a17 a21 a22 a23 a24 a25 a26 a27 a31 a32 a33 a41 a42
  • 44.
  • 45.
    Declaring and initializingof string variables
  • 52.
  • 53.
    String handling function •The Library function in the header file string.h are Used to carry out string manipulations. strlen() this function is used to find out number of character in the given string ie lenth of string .the syntax is
  • 57.
  • 58.
  • 59.
  • 62.
    Input “lion” “tiger” Outputsecond string is greater than the first
  • 64.
  • 66.
    Program to copya string into another without string function #include<stdio.h> main() { char s1[10],s2[10]; Int i=0; printf(“enter the string to be copiedn”); scanf(“%s”,s1); while(s1[i]!=‘0’) { s2[i]=s1[i]; i++; } s2[++i]=‘0’; puts(s2); }
  • 67.
    Program to reversea string without string function #include<stdio.h> main() { char s1[10],s2[10]; int L=0; printf(“enter the string to be reversedn”); scanf(“%s”,s1); while(s1(L) != ‘0’) L++; j=L; for(i=0;i<L;i++) { j--; s2[j]=s1[i]; } s2[L]=‘0’; puts(s2); }
  • 68.
    Program to concatenatetwo string without string function #include<stdio.h> main() { char s1[10],s2[10]; int L,I,j; printf(“enter two strings to be concatenatedn”); scanf(“%s%s”,s1,s2); while(s1(L) != ‘0’) L++; i=L; i=0; while(s2[i]!=‘0’) { s1[j]=s2[i]; j++; i++; } s1[++j]=‘0’; puts(s2); }