Techhgeekz ™
Saturday 31 August 2013
finding the length of the char array without '\0'
finding the length of the char array without '\0'
#include <stdio.h>
#include <string.h>
int main()
{
char *s[]={"s","a","b"};
int a= sizeof(s) / sizeof(char *); // 8(
pointer char array)
x 3(no.of char)=24 //24/8=3
printf("%d",a);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment