Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the explanation of the first line of the function secret?

What is the meaning of the first line in the function secret? What is the output of return secret(3,argv)?

#include <stdio.h>
int secret(int argc, char **argv)
{
 *argv && secret(0, argv + 1) &&
 argc == 0 && printf("%s\n", *argv);
 return argc == 0;
}
int main()
{
 char *argv[] = {"hello", "XYZ", "123", "ABC", NULL};

 return (secret(3,argv));
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

This

*argv && secret(0, argv + 1) &&
argc == 0 && printf("%s\n", *argv);

is a tricky (and harder to read, I think) way to write

if ( *argv && secret(0, argv + 1) && argc == 0 ) {
    printf("%s\n", *argv);
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading