How to transfer control from one function to another in C language

krahul44

Honorable
Feb 28, 2012
17
0
10,560
0
Hello

I am noob in C programming... Just started learning it.

Please correct this code..

C++:
#include <stdio.h>
#include <conio.h>
#include <math.h>
void multi(int); //prototype of function
int main(int argc, char** argv) 
{
	int x,y=1;
	while(y==1)

	{	
	printf("\nEnter number to find its multiplication:\n");
	scanf("%d",&x);
	printf("\nThe multiplication of %d is as follows:-\n",x);
	multi(x);// function calling statement
	printf("\nPlease press 1 to continue\n",y);
	scanf("%d",&y);
	}
	getch();

}
void multi(int num)
{
	int i;
	for(i=1;i<=10;i++)// Loop
	{
		printf("\n%d X %d = %d\n",num,i,num*i);
	}
	return;

}
As u can see i have used while loop for jumping control back to the beginning. This way i don't need to restart cmd again. In the multi function i want to transfer control back to its calling statement after its task so that it can show the printf statement below it. How do i do that?
If there are any errors in the code, then please correct them.


Thank you
 
Thread starter Similar threads Forum Replies Date
K Apps General Discussion 1
M Apps General Discussion 1
K Apps General Discussion 0
R Apps General Discussion 0
H Apps General Discussion 2
C Apps General Discussion 0
N Apps General Discussion 2
M Apps General Discussion 6
M Apps General Discussion 1
B Apps General Discussion 0
R Apps General Discussion 1
J Apps General Discussion 1
O Apps General Discussion 1
R Apps General Discussion 2
A Apps General Discussion 1
H Apps General Discussion 3
G Apps General Discussion 5
A Apps General Discussion 4
henrytcasey Apps General Discussion 2
M Apps General Discussion 1

Similar threads


ASK THE COMMUNITY