answersLogoWhite

0

Is float type array possible in C?

Updated: 12/14/2022
User Avatar

Piter007

Lvl 1
14y ago

Best Answer

Yes. For example:

float f_array[3];
double d_array[2];

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is float type array possible in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you write a program in C to find and display the sum of each row and column of a 2 dimensional array of type float?

array type


How do you declare an array of 8 floats?

In C float a[8]; In Java float a[] = new float[8];


Is it possible to store different type of variables in a single array?

Possible in some languages (mainly scripts like PHP, JavaScript), not possible in others (eg C, Pascal).


How do you create a program that will let the user to enter 10 numbers and arrange it in ascending and descending?

#include "stdio.h" #define ARRAY_SIZE 10 void fill(float* array, int size); void spill(float* array, int size, char* delimiter); void bubble_sort(float* array, int size); void reverse(float* array, int size); void swap(float* a, float* b); int main(int argc, char* argv[]) { float numbers[ARRAY_SIZE]; fill(numbers, ARRAY_SIZE); bubble_sort(numbers, ARRAY_SIZE); spill(numbers, ARRAY_SIZE, " "); reverse(numbers, ARRAY_SIZE); spill(numbers, ARRAY_SIZE, " "); return 0; } void fill(float* array, int size) { int i = 0; while (i < size) fscanf(stdin, "%f", array + (i++)); } void spill(float* array, int size, char* delimiter) { int i = 0; while (i < size) fprintf(stdout, "%f%s", array[i++], delimiter); fputc('\n', stdout); } void bubble_sort(float* array, int size) { int i, j; for (i = 0; i < size; i++) for (j = i; j < size; j++) if (array[i] > array[j]) swap(array + i, array + j); } void reverse(float* array, int size) { int i; for (i = size / 2; i >= 0; i--) swap(array + i, array + (size - (i + 1))); } void swap(float* a, float* b) { float c = *a; *a = *b; *b = c; } fill gets the numbers from input spill sends them to output bubble sort will sort the array in ascending order reverse will reverse the list so that it is in descending order swap is used to swap two floats You can change float to double or int depending on which datatype you want to use.


Is an array is a collection of characters that can be fixed or variable?

No. An array is a collection of objects of any type, such as doubles, not just characters. You can even have arrays of arrays, or arrays of structs. In C, the size of an array is fixed, but it is possible to write code that will allow you to manually make it variable in size.


What is return type of string in c?

In C programming, a string doesn't have a specific return type as it's essentially an array of characters. So, if a function is returning a string, it should be declared to return a pointer to a char (char*), since a string in C is represented as an array of characters terminated by a null character ('\0').


How do you convert char array into unsigned char array in c?

You can't convert the data type of any variable.


What is primare datatype in c?

primary datatypes means the data types which are provided by developer of language himself like int,float,double,char are the primary data types in c language where as the String,array are nothing but the derived data types. for Ex.we derived the String data type from char datatype using array system.


Array is value type or reference type in c?

An array always stores the values in its different shells. Whenever the shell position or number or address is mentioned it means the address of the required value is mentioned. then the value of the mentioned address is fetched. So, array is a reference type in c language.


How can you store Class properties in Array in c?

Yes, you can create array that will store class properties. But all of them have to be of the same type.


What is the different type of data type in c classified it?

float,int,char


What is an array in c program?

A type construction: one or more values with the same type and name.