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

Does this code have anything to do with pointers?

Could somebody help me with this piece of code.
I have no idea that what it does.

#include <stdio.h>

int main()
{
    int arr[5],i;
    int a = 1, n = 5;

    for (i=0; i<5;a+= arr[i++]);
    int d = a;
    printf("%d",d);

}

>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

yes you have one array names arr(arrays are pointer to the single values) and then you go into the for loop and because you didnt gave arr[0-5] any numbers these are random, so a gets random numbers. then d = a that means you give the value of a to d. and then you print d

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