Read OnLine C- Program Example

09_STRING
PRAC 1 PRAC 2
//wap to print Imacc
#include<stdio.h>
#include<conio.h>
void main()
{
// char a[20]={'A','R','V','I','N','D','\0'};
// char a[20]="Arvind";
// char a[]="Arvind";
char str[]="Imacc";
clrscr();
printf("%s",str);
getch();
}
----------output-------------
Imacc
//wap to print fiend string length
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int l1,l2;
char str1[]="Imacc";
char str2[]="Imacc Education";
clrscr();
l1=strlen(str1);
l2=strlen(str2);
printf("\n First String Length=%d",l1);
printf("\n Second String Length=%d",l2);
getch();
}
----------output------
5
15
Previous Next
Download Download