Thread: İt is Possible ?

  1. #1
    Registered User
    Join Date
    Jan 2017
    Posts
    2

    İt is Possible ?

    Code:
    #include <stdio.h>#include <stdlib.h>
        int arraysum(int array_sum[][],int size1,int size2){
        int i,j,sum=0;
        for(i=0;i<size1;i++){
                for(j=0;j<size2;j++){
                    sum =sum+array_sum[i][j];
                }
        }
        return sum;
    }
    
    
    int main()
    {
        int array [4][4]= {{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}};
        int a,b,mysum;
        for(a=0;a<4;a++){
                for(b=0;b<4;b++){
                        printf("Your number is[%d][%d]=[%d]\n",a,b,array[a][b]);}
    
    
    
    
        }
        mysum =arraysum(array,4,4);
        printf("My Sum is = %d", mysum);

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Sure, you just need to specify the sizes of the minor dimensions.

    int arraysum(int array_sum[][4],int size1,int size2)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Tags for this Thread