void main()
{
char ch[40]={'p','g','\0','d','c','a'};
int len=strlen(ch);
printf("string =%s and length of the string =%d",ch,len);
}
Output : string =pg and length of the string =2
Explanation: String ends with null character.
void main()
{
static int a[19];
clrscr();
printf("%d",sizeof(a));
return;
}
Output: 38
Explanation: size of int a[19] =19*2=38
Subscribe to:
Post Comments (Atom)
Related Post
Array:
String functions:
General (Loops-for/while)
No comments:
Post a Comment