Write a program to returning more than one value from a function.
C Programming Language / Pointer in C Language
906Program:
#include"stdio.h" int main() { float r, area, perimeter; float compute(float,float*); printf("\n enter the radius of the circle:"); scanf("%f",&r); area=compute(r, &perimeter); printf("\n AREA = %f", area); printf("\n PERIMETER = %f", perimeter); return 0; } float compute(float r, float *p) { float a; a=(float)3.1415 * r * r; *p=(float)3.1415 * 2 * r; return a; }
Output:
enter the radius of the circle:5 AREA = 78.537506 PERIMETER = 31.415001
Explanation:
None
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS