Sunday, 23 February 2014

how to pass dimensional array in to fuction in c

how to pass dimensional array in to fuction in c

#include<stdio.h>
#define n 5
void fstore1d(int a[],int a_size);
void fretrieve1d(int a[],int a_size);
void feditid(int a[],int a_size);
int main()
{
    int a[n];
    printf("intput data into the matrix:\n");
    fstore1d(a,n);
    fetrieve1d(a,n);
    fedit1d(a,n);
    fretrieve1d(a,n);
    return 0;
}
void fstore1d(int a[],int n)
{
    int i;
    for(i=o;i<n;++i)
        scanf("%d",&a[i]);
}
void fretrieve1d(int a[],int n)
{
    int i;
    for(i=0;i<n;++i)
        printf("%6d",a[i]);
        printf("\n");
}
void fedit1d(int a[],int n)
{
    int i,q;
    for(i=0;i<n;++i)
        printf("prev data :%d\nEnter 1 to edit o to skip",a[i]);

    if(q==1)
    {
        printf("Enter new value");
        scanf("%d",&a[i]);

    }
}




No comments:

Post a Comment