int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
{ length++; s++; }
return (length);
}
int xstrlen(char s)
{
int length=0;
while(*s!='\0')
length++; s++;
return (length);
}
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
length++;
return (length);
}
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
s++;
return (length);
}
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
{ length++; s++; }
return (length);
}
Example:
#include<stdio.h>
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
{ length++; s++; }
return (length);
}
int main()
{
char d[] = "CuriousTab";
printf("Length = %d\n", xstrlen(d));
return 0;
}
Output: Length = 8
#include<stdio.h> int main() { char huge *near *far *ptr1; char near *far *huge *ptr2; char far *huge *near *ptr3; printf("%d, %d, %d\n", sizeof(ptr1), sizeof(ptr2), sizeof(ptr3)); return 0; }
#include<stdio.h> int main() { struct node { int data; struct node *link; }; struct node *p, *q; p = (struct node *) malloc(sizeof(struct node)); q = (struct node *) malloc(sizeof(struct node)); printf("%d, %d\n", sizeof(p), sizeof(q)); return 0; }
After sometime the stack memory will be filled completely. Hence stack overflow error will occur.
#include<stdio.h> int main() { int arr[] = {12, 13, 14, 15, 16}; printf("%d, %d, %d\n", sizeof(arr), sizeof(*arr), sizeof(arr[0])); return 0; }
void *cmp();
Comments
There are no comments.Copyright ©CuriousTab. All rights reserved.