Wednesday 13 February 2013

String - Handling Functions Using Pointers C Programming Language



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

Powered by Blogger.