string operation
-
In C, a string is simply an array of characters. So to read each character you simply index into the array -
char arr[10]; /* String */
arr[0]; /* First character */
arr[9]; /* Last character */«_Superman_» _I love work. It gives me something to do between weekends.
-
char str[10]="hghghhj" int i; for(i=0;i<10;i++) printf("%c",str[i]);
-
robin700 wrote:
how to read a string...
This is very ambiguous. Read a string from where?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
Read from what?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]