Click here to Skip to main content
13,867,936 members

ATL / WTL / STL

 
GeneralRe: To take input for n number of arrays and print it. Pin
Tarun Jha10-Dec-17 7:11
memberTarun Jha10-Dec-17 7:11 
GeneralRe: To take input for n number of arrays and print it. Pin
Richard MacCutchan10-Dec-17 7:18
protectorRichard MacCutchan10-Dec-17 7:18 
GeneralRe: To take input for n number of arrays and print it. Pin
Tarun Jha10-Dec-17 7:48
memberTarun Jha10-Dec-17 7:48 
GeneralRe: To take input for n number of arrays and print it. Pin
Richard MacCutchan10-Dec-17 7:52
protectorRichard MacCutchan10-Dec-17 7:52 
GeneralRe: To take input for n number of arrays and print it. Pin
Tarun Jha10-Dec-17 8:19
memberTarun Jha10-Dec-17 8:19 
AnswerRe: To take input for n number of arrays and print it. Pin
Member 1332249811-Dec-17 9:55
memberMember 1332249811-Dec-17 9:55 
GeneralRe: To take input for n number of arrays and print it. Pin
Tarun Jha11-Dec-17 11:56
memberTarun Jha11-Dec-17 11:56 
GeneralRe: To take input for n number of arrays and print it. Pin
Tarun Jha16-Dec-17 6:41
memberTarun Jha16-Dec-17 6:41 
in the code below i have tried using recursion for printing output, but it's not working can you tell me what's wrong.
<pre>#include <stdio.h>

int final_array(int arr[], int size, int k, int i);
void array(int arr[], int i, int size);

int main()
{
	int num, size[100];
	int i, j, k=0;
	int arr[100][100];

	printf("Enter the number of arrays: \t");
	scanf("%d", &num);
	num = num < 100 ? num: 100;
	//feeding elements.
	for (i = 0; i<num; i++)
	{
		printf("\nEnter the size of the array: \t");
		scanf("%d", &size[i]);

		printf("\nEnter the array: ");
		//int arr[i][size[i+1]];
		size[i] = size[i] < 100 ? size[i] : 100;
		array(&arr[i][0], i, size[i]);
	}

	for(i=0; i<num; i++)
    {
        final_array(&arr[i][0], size[i], k, i);
        printf("\n");
    }

	printf("\nPress Enter key to exit.\n");
	getchar();

	return 0;
}

void array(int arr[], int i, int size)
{
	int j;
	for (j = 0; j<size; j++)
	{
		printf("\nEnter arr[%d][%d]: \t",i, j);
		scanf("%d", &arr[j]);
	}
}

int final_array(int arr[], int size, int k, int i)
{
    if(k<=size)
    {
        printf("%d", arr[k]);
        final_array(&arr[i][0], size[i], k++, i);
    }
    else
        return 0;


    /*
    int j;
    for(j=0; j<size; j++)
    {
    	printf("%d\t", arr[j]);
	}
	*/
}


QuestionHow do I keyboard input in OpenGL Pin
Mr. Anup Roy1-Dec-17 4:57
professionalMr. Anup Roy1-Dec-17 4:57 
QuestionHow to get cpu speed and ram manufaturer C Languae? Pin
Uzair Ahmad12-Nov-17 5:56
memberUzair Ahmad12-Nov-17 5:56 
AnswerRe: How to get cpu speed and ram manufaturer C Languae? Pin
Afzaal Ahmad Zeeshan1-Dec-17 5:32
mveAfzaal Ahmad Zeeshan1-Dec-17 5:32 
QuestionHow to Disable open drop down Pin
yaswanthdasari24-Oct-17 22:36
memberyaswanthdasari24-Oct-17 22:36 
SuggestionRe: How to Disable open drop down Pin
Richard MacCutchan24-Oct-17 23:44
protectorRichard MacCutchan24-Oct-17 23:44 
GeneralRe: How to Disable open drop down Pin
yaswanthdasari25-Oct-17 1:38
memberyaswanthdasari25-Oct-17 1:38 
AnswerRe: How to Disable open drop down Pin
Daniel Pfeffer25-Oct-17 2:11
professionalDaniel Pfeffer25-Oct-17 2:11 
GeneralRe: How to Disable open drop down Pin
yaswanthdasari26-Oct-17 0:50
memberyaswanthdasari26-Oct-17 0:50 
QuestionHow To Add a Dll TO MFC Application in visual Studio Pin
Member 1347149317-Oct-17 22:50
memberMember 1347149317-Oct-17 22:50 
QuestionRe: How To Add a Dll TO MFC Application in visual Studio Pin
Richard MacCutchan17-Oct-17 22:58
protectorRichard MacCutchan17-Oct-17 22:58 
AnswerRe: How To Add a Dll TO MFC Application in visual Studio Pin
Member 1347149317-Oct-17 23:09
memberMember 1347149317-Oct-17 23:09 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Richard MacCutchan17-Oct-17 23:12
protectorRichard MacCutchan17-Oct-17 23:12 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Member 1347149317-Oct-17 23:29
memberMember 1347149317-Oct-17 23:29 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Richard MacCutchan17-Oct-17 23:45
protectorRichard MacCutchan17-Oct-17 23:45 
AnswerRe: How To Add a Dll TO MFC Application in visual Studio Pin
Jochen Arndt17-Oct-17 23:44
mveJochen Arndt17-Oct-17 23:44 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Member 1347149318-Oct-17 0:13
memberMember 1347149318-Oct-17 0:13 
GeneralRe: How To Add a Dll TO MFC Application in visual Studio Pin
Jochen Arndt18-Oct-17 0:29
mveJochen Arndt18-Oct-17 0:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190214.1 | Last Updated 19 Feb 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid