All pastes #376241 Raw Edit

Miscellany

public text v1 · immutable
#376241 ·published 2007-02-28 22:40 UTC
rendered paste body
#include<stdio.h>
#include<stdlib.h>

int main(void)
{
  int ht = 5;
  int wt = 6;
  
  //------dynamic initialisation of a 2d array-----------
  float **acc = calloc(ht, sizeof(float*));
  int i=0;
  for (;i<ht;i++)
  {
    acc[i] = calloc(wt, sizeof(float));
  }
  //------dynamic initialisation of a 2d array-----------//
    
  
  
  
  
  
  
  
  int a = 0;
  int b = 0;
  for (a=0;a<ht;a++)
  {
    for (b=0;b<wt;b++)
    {
      acc[a][b] = a+b;
    }
  }  
  
  for (a=0;a<ht;a++)
  {
    for (b=0;b<wt;b++)
    {
      printf("acc[%d][%d]=%f\n", a, b, acc[a][b]);
    }
  }
  
  return 0;
}