Define the while loop, Computer Engineering

Assignment Help:

The while Loop

The while loop repeats a statement until the test at the top proves false. As an example, here is a function to return the length of a string.

int string_length(char string[])

{

int i = 0;

while (string[i] != '\0') I++;

return(i);

}

The string is passed to the function as an argument. The size of the array is not specified, the function will work for a string of any size. The while loop is used to look at the characters in the string one at a time until the null character is found. Then the loop is exited and the index of the null is returned. While the character isn't null, the index is incremented and the test is repeated.

 


Related Discussions:- Define the while loop

Effect of tree supply on death rate, The effect of tree supply on death ra...

The effect of tree supply on death rate depends upon a ratio comparing the number of trees that are actually available per person per year to the desired number of trees per pers

Swing, how to make a dfd of simple calculator?

how to make a dfd of simple calculator?

Struct and class, https://dl.dropbox.com/u/41918180/Images/Pro%202/2.png ...

https://dl.dropbox.com/u/41918180/Images/Pro%202/2.png https://dl.dropbox.com/u/41918180/Images/Pro%202/3.png https://dl.dropbox.com/u/41918180/Images/Pro%202/4.png">https://dl.d

The advantages of specifying parameters during instantiation, The advantage...

The advantages of specifying parameters during instantiation method are: -  All values to all the parameters do not need to be specified. Only those parameters that are assigne

Explain passing parameters using pointers, Q. Explain Passing Parameters Us...

Q. Explain Passing Parameters Using Pointers ? This method overcomes the drawback of using variable names directly in procedure. It uses registers to pass procedure pointers to

Explain about hyper-threading, Q. Explain about Hyper-threading? Non th...

Q. Explain about Hyper-threading? Non threaded program instructions are executed in a single order at a time until the program completion. Presume a program have four tasks nam

Advantages and disadvantages of shared memory programming, Q. Show Advantag...

Q. Show Advantages and Disadvantages of Shared Memory Programming? Advantages of Shared Memory Programming Data sharing between processes is both rapid and uniform bec

Big – endian and little- endian representations, Explain Big - Endian and L...

Explain Big - Endian and Little- Endian representations Ans: The Big- endian is used where lower byte addresses are used for the more significant bytes (leftmost bytes) of the

Sequential logic gates - sr flip flop, Sequential Logic Gates SR flip ...

Sequential Logic Gates SR flip flop                                                                                                                    1)

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd