cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Mystery for loop
Mystery for loop
May 13, 2016 at 8:53am UTC
Nick89
(4)
Hi all,
I found this piece of code in my notes and I have no idea why its there or what it does. I was hoping someone can shed some light on it for me.
Thanks
stringone[20]
for (int i = 0; i < 20; i++)
{
stringone[i] = '\0';
}
May 13, 2016 at 9:24am UTC
ephraimr
(114)
I am assuming this is the code :
Well, did you mean
char
stringone[20]
The loop goes through all the chars in array and replaces them with the null character one by one.
Last edited on
May 13, 2016 at 9:26am UTC
May 14, 2016 at 12:39pm UTC
Nick89
(4)
You would assume correctly.
Thanks
Topic archived. No new replies allowed.