[ create a new paste ] login | about

Link: http://codepad.org/y5MGgE4f    [ raw code | output | fork ]

C, pasted on Nov 30:
#include <stdio.h>

int main ( void )
{
	int i,j ;
	FILE* fp;

	int tmp[][5]={
		{ 1, 2, 3, 4, 5 },
		{ 3, 5, 6, 7, 8 },
		{ 8, 4, 2, 5, 7 },
		{ 5, 4, 6, 7, 6 },
	};

	fp = fopen ( "data.txt", "w" ) ;

	for ( i = 0 ; i < sizeof(tmp)/sizeof(*tmp) ; i++ ){
		for ( j = 0 ; j < sizeof(*tmp)/sizeof(**tmp) ; j++ ){
			fprintf ( fp, "%d", tmp[i][j] ) ;
		}
		fputs( "\n", fp ) ;
	}	

	fclose ( fp ) ;

	return 0 ;
}


Output:
1
Segmentation fault


Create a new paste based on this one


Comments: