Hi, are there any alternative ways to return multiple value in only one function without using pointers, global variables, struct and macros?
*I have done it using pointers, but I want to know if there are any alternative ways to do it*
My example code using pointer
Code:
#include <stdio.h>
#include <stdlib.h>
void get_print_Sales(); //Get the sales & print it using printSales function
void printSales(int *s, int *t); //Include this in get_print_Sales to print the sales in get_print_Sales function
int main(void)
{
get_print_Sales();
return 0;
}
void get_print_Sales()
{
int sales, tax;
printf("Enter sales amount : ");
scanf("%d", &sales);
printf("Enter tax amount : ");
scanf("%d", &tax);
printSales(&sales, &tax);
}
void printSales(int *s, int *t)
{
printf("Sales amount : %d", *s);
printf("Tax amount : %d", *t);
}