answersLogoWhite

0


Best Answer

I don't really understand your question, but for example the following code is perfectly legal:

float f;

for (f=0.0; f<=1.00001; f += 0.1) printf ("%g\n", f);

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can you declare float variable as increment operator in for loop?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you declare a variable with initial value of 20.1234?

float myVariable = 20.1234;


How do you declare a pointer variable in c?

int* pint; // instantiate a pointer to an int. float* pflt; // instantiate a pointer to a float.


What is i plus 1 operator in C plus plus?

The increment operator in C++ is defined by operator++(). All arithmetic types (char, int, float, double, long, short, long long and long double) and all pointer types except void* are supported by operator++(). User-defined types can overload operator++() to provide support where required. operator++() has two versions, prefix increment and postfix increment. Prefix increment behaves as one would expect, incrementing the operand by 1 and returning the modified value. Postfix increment also increments the operand, however, the return value is the pre-incremented value. To understand the difference between prefix and postfix, consider the following: int i = 0; int j = ++i; // i=1, j=1 int i = 0; int j = i++; // i=1, j=0


Which keyword is used to declare constants and variable?

Constants are defines using the final keyword.Variables are defined using the one of the keywords:charbooleanintdoublelongintStringTo use a constant you would have to put in something likedouble final pi = 3.14;


What is size of operator in c language?

it is used to know the memory size of variable of data type. Ex: float a; printf ("sizeof (a)= %d\n", sizeof (a)); or: printf ("sizeof (float)= %d\n", sizeof (float));


How can an individual structure member be accessed in terms of its corresponding pointer variable?

By dereferencing the pointer variable. This can be achieved in two ways: typedef struct s { int i; float f; }; void f (struct s* p) { int x = p-&gt;i; /* using pointer to member operator */ float y = (*p).f; /* using dereference operator */ } The two methods are functionally equivalent.


How do you declare a function to return long float?

long float myfun();


How do you declare an array of 8 floats?

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


When you assign the value 5.628 into a float variable how can you avoid getting the decimal truncation warning?

When assigning a literal value, such as 5.628, to a float variable, you can avoid the decimal truncation warning by either using the float form of the constant (float var = 5.628f), typecasting the assignment (float var = (float) 5.628), or by making the variable double (double var = 5.628).


Can there be a negative float?

A float variable can store both positive and negative numbers.


'How many bytes is a float variable'?

4


How do you declare many float variables in java?

You can declare them one by one. However, if you want to store lots of related data, you may want to consider using an array, where you use a single variable name (for example) for 1000 different items, and a number called an index to access the individual items.