Strings are treated like character arrays and therefore, they are declared and initialized as follows.
char s1[5]="hello"
A character array can also be declared suing pointers as
char *s1="hell";
The pointer "s1" points" to first element in the array. The array name is first element address.
Example:
void main() { char *s1="hello"; printf("%s",s1); getch(); }
0 comments :
Post a Comment
Note: only a member of this blog may post a comment.