Now that we have laid the groundwork for understanding the concept of pointers, we will write a few functions to manipulate strings using pointers.
#include <stdio.h>
main()
{
char *ptr,str[20];
int size=0;
printf("\nEnter String :");
gets(str);
fflush(stdin);
for(ptr=str; *ptr != '\0' ; ptr++)
{
size++;
}
printf("String length is %d", size);
}
0 comments:
Post a Comment