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

I can compile my code without getting errors, but it's not working anyways

#include<stdio.h>
#include<conio.h>
int main(){
    int marks[3];
    printf("enter number for first array");
    scanf("%d",marks[0]);
    printf("enter number for second array");
    scanf("%d",marks[1]);
    printf("enter number for third array");
    scanf("%d",marks[2]);
        printf("the value of first array is %d",marks[0]);
        printf("the value of first array is %d",marks[1]);
        printf("the value of first array is %d",marks[2]);
    return 0;   
}

i was expecting that it will print value of matrix but it keeps saying this progarm has unexpectly closed down

>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

scanf() expects you to pass the address of the variable to fill, eg:

scanf("%d",&marks[0]);

& is the address-of operator which provides that.

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