daily pastebin goal
37%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int* linie(int n,int k)
  4. {
  5.     int *v=NULL;
  6.     v=(int*)malloc(n*sizeof(int));
  7.     for(int i=0; i<n; i++)
  8.         if(i%2==0)
  9.             v[i]=k;
  10.         else
  11.             v[i]=i;
  12.     return v;
  13. }
  14. void matrice(int *nrl,int *nrc,int ***a)
  15. {
  16.     scanf("%d %d",&nrl,&nrc);
  17.     (*a)=(int**)malloc((*nrl)*sizeof(int));
  18.     for(int i=0; i<nrl; i++)
  19.         (*a)[i]=linie((*nrc),i);
  20.          for(int i=0; i<(*nrl); i++)
  21.         for(int j=0; j<(*nrc); j++)
  22.             printf("%d",a[i][j]);
  23. }
  24. int main()
  25. {
  26.     int i,j,k;
  27.     int v[50],nrc,nrl,**a;
  28.     matrice(&nrl,&nrc,&a);
  29.  
  30.     return 0;
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top