Recent Posts
None | 1 sec ago
None | 7 sec ago
None | 12 sec ago
None | 23 sec ago
PAWN | 33 sec ago
None | 34 sec ago
Java | 47 sec ago
None | 59 sec ago
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Domain Reports
By Peter Toft on the 17th of Jul 2007 03:58:46 PM
Download |
Raw |
Embed |
Report
#include <stdio.h>
#include <malloc.h>
void fed(int *a)
{
int ii;
int b;
for (ii=0;ii<3;ii++) {
b=a[ii];
printf("%i\n",b);
}
}
void fed2(int **a)
{
int ii;
int jj;
for (ii=0;ii<2;ii++) {
for (jj=0;jj<3;jj++) {
printf("%i ",a[ii][jj]);
}
printf("\n");
}
}
int main()
{
int *a;
int **b;
int c[2][3];
a=(int *)malloc(3*sizeof(int));
a[0] = 1;
a[1] = 6;
a[2] = 8;
/* Allocate b */
b=(int **)malloc(2*sizeof(int*));
b[0]=(int *)malloc(3*sizeof(int));
b[1]=(int *)malloc(3*sizeof(int));
/* Init b */
b[0][0] = 2;
b[0][1] = -2;
b[0][2] = 22;
b[1][0] = 12;
b[1][1] = -12;
b[1][2] = 212;
/* Init c */
c[0][0] = 2;
c[0][1] = -2;
c[0][2] = 22;
c[1][0] = 12;
c[1][1] = -12;
c[1][2] = -12;
fed(a);
fed2(b);
return 0;
}
Submit a correction or amendment below.
Make A New Post