I am analyzing a C++ console based program but I am very newbie to C++ and I want to learn it. Main reason, why I am analyzing this code, becouse I need to remake it by myself but in form of MFC dialog.
Okay, I have couple of questions and I hope, someone will help me...
1) Does this one makes an array? If so, then, all the array values from 1..32 will be empty, if I call set[1] or any other?
int set[32]
2) What will I get, when I will call just: "set", not "set[n]" ?
3) What will I get, when I will say "set+k" if:
int k=0;
4) What is doing this loop? I know that "EOF" is EndOfFile that is CTRL+Z, but what this loop does?
while (k<32 && scanf("%d",set+k)!=EOF) k++;
5) What is doing here:
for (i=0;i<k-1;i++) printf("%d,",set[i]);
6) What this will "set[k-1]" print out?
if (k) printf("%d",set[k-1]);
Okay, (not a)full code, if you ask, is here:
int main(void) /*demo*/
{
int set[32],i;
int k=0;
printf("enter the set elements separated by blanks and ctrl-z at the "
"end\n");
while (k<32 && scanf("%d",set+k)!=EOF) k++;
printf("your set:\n{");
for (i=0;i<k-1;i++) printf("%d,",set[i]);
if (k) printf("%d",set[k-1]);
printf("}\n");
printf("its subsets:\n");
subsets(set,k);
return 0;
}
I will have a couple of more questions later on...