answersLogoWhite

0

What do the function gcvt do in C?

Updated: 12/23/2022
User Avatar

Wiki User

12y ago

Best Answer

The gcvt() function converts a floating-point number to a string. It converts given value to a null-terminated string.

example....

#include #include int main(void) { char str[25]; double num; int sig = 5; /* significant digits */ /* a regular number */ num = 9.876; gcvt(num, sig, str); printf("string = %s\n", str); /* a negative number */ num = -123.4567; gcvt(num, sig, str); printf("string = %s\n", str); /* scientific notation */ num = 0.678e5; gcvt(num, sig, str); printf("string = %s\n", str); return(0); }

Output:

string = 9.876

string = -123.46

string = 67800

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What do the function gcvt do in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the functions of Atoi itoa and gcvt in C language?

All these are conversion functions - atoi()-string to integer.itoa()-integer to string.gcvt()-double to string


How to print float or double without using printf?

With functions like ecvt, fcvt, gcvt.


What is C and function it?

It is a letter and function it.


Main function in c?

The main function defines the entry point of an application in C.


What are the building function in c plus plus?

There is no such term as "building function" in C++.


How do you use this function in c programme?

I don't use that function in C programme.


What is the differnce between ordinary function and template function of c language?

The c language does not have template functions. That is a c++ thing.


Who is calling main function in c?

in c main function initailly called by operating system.


What is main function used in c?

if you do not used main function in c program when errors are accrued


Can a Horizontal line represent a function?

Yes. It is the function f(x) = c where c is a constant.


What is a linear function?

A function of the form f(x) = mx + c where m and c are constants is linear.


Function prototype in c?

Yes. Examples can be found in stdio.h