Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- #include <stdlib.h>
- #include <errno.h>
- //#define calloc(...) NULL; errno = ENOMEM;
- #define COLS 4
- void checkAlloc(void *p) {
- if (p == NULL) {
- perror("alloc err");
- exit(EXIT_FAILURE);
- }
- }
- int main(void) {
- int n;
- scanf("%d", &n);
- int (*arr)[COLS] = NULL;
- arr = calloc(sizeof(int[COLS]), n);
- checkAlloc(arr);
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < COLS; j++) {
- scanf("%d", &arr[i][j]);
- }
- }
- printf("ascendent rows: ");
- for (int i = 0; i < n; i++) {
- bool ok = true;
- for (int j = 1; j < COLS; j++) {
- ok &= arr[i][j - 1] < arr[i][j];
- }
- if (ok) {
- printf("%d ", i);
- }
- }
- puts("");
- free(arr);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement