DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Ejemplo De Matrices En C

09.22.2006
| 18720 views |
  • submit to reddit
        Se crea un matrix dinamica en c, y luego se muestra, el tamano de muestra siempre es de 10x10

#include <stdio.h>
#include <stdlib.h>

void mostrar(int **a){
	 int i,j;
	for (i=0;i<10;i++){
		for (j=0;j<10;j++){
		printf("%i",a[i][j]);
		}
		printf("\n");
	}	
	 
};

int main(){
	int i,j,**a;
	a=(int**)malloc(10*sizeof(int*));

	for (i=0;i<10;i++){
		a[i]=(int*)malloc(10*sizeof(int));
		for (j=0;j<10;j++){
			a[i][j]=i;	
		}
	}	
	mostrar(a);
	getchar();
	return 0;
}