LINUX.ORG.RU

История изменений

Исправление qulinxao, (текущая версия) :

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <u.h>
#include <libc.h>
#define N 10
#define sz (((N)+1)*(N))
int
main(){
	srand((unsigned)time(NULL));
        int *sq;
	if(NULL==(sq=malloc(sz*sizeof(int)))){
		sysfatal("ну ты понял %d int'ов: %r такие дела", sz);
	}
	int i,j;
	for(i=j=0,i<=(N);i++,j+=(N))sq[i]=j;
	for(i++;i<sz;sq[i++]=rand());
	printf("%d\n",0[sq+5][sq+5]);
	free(sq);
	return 0;
}

всем чмоки в этом чате;

Исправление qulinxao, :

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <u.h>
#include <libc.h>
#define N 10
#define sz (((N)+1)*(N))
int
main(){
	srand((unsigned)time(NULL));
	int **sq;
        int *sq;
	if(NULL==(sq=malloc(sz*sizeof(int)))){
		sysfatal("ну ты понял %d int'ов: %r такие дела", sz);
	}
	int i,j;
	for(i=j=0,i<=(N);i++,j+=(N))sq[i]=j;
	for(i++;i<sz;sq[i++]=rand());
	printf("%d\n",0[sq+5][sq+5]);
	free(sq);
	return 0;
}

всем чмоки в этом чате;

Исходная версия qulinxao, :

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <u.h>
#include <libc.h>
#define N 10
#define sz (((N)+1)*(N))
int
main(){
	srand((unsigned)time(NULL));
	int **sq;
        int *sq;
	if(NULL==(sq=malloc(sz*sizeof(int)))){
		sysfatal("ну ты понял %d int'ов: %r такие дела", sz);
	}
	int i,j;
	for(i=j=0,i<=(N);i++,j+=(N))sq[i]=j;
	for(i++;i<sz;sq[i++]=rand());
	printf("%d\n",0[sq+5][sq+5]);
	free(sq);
	return 0;
}

всем чмоки в этом чате;