0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

C言語で標準入力から二次元(多次元)配列を受け取る方法

Last updated at Posted at 2023-01-16

あとで整理したい

注意

[paiza]のSTEP: 18 二次元配列の入力 3のネタバレあり。

正解したコード

#include <stdio.h>
int	main(void)
{
	int	n;
    scanf("%d",&n);
	//printf("%d\n",n);
	int a[n][5];
	int j;
	for (int i = 0; i < n; i++)
	{
		for (j = 0; j < 5; j++)
		{
			if(j >= 1){
				printf(" ");
			}
			scanf("%d",&a[i][j]);
			printf("%d", a[i][j]);
		}
		printf("\n");
	}
	return (0);
}

ググったキーワード

二次元配列 c言語 for文 仕組み

参考記事まとめ

二次元配列をfor文で回す
AtcoderのC++で多次元配列の解説

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?