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

What is a convertor?, Converter is an application that converts distance me...

Converter is an application that converts distance measurements among metric and U.S units.

Difference between leave transaction and call transaction, What is the diff...

What is the difference between Leave Transaction and Call Transaction? In contrast to LEAVE TO TRANSACTION, the CALL TRANSACTION  statement causes the system to start a new SAP

Using information in information system, Using Information in Information S...

Using Information in Information System Information Systems can be thought of as being useful at three levels:  The detail level where information is used to carry out disc

Using the editor or debugger, Write a script that will read from a file x a...

Write a script that will read from a file x and y data points in the following format: x   0    y  1 x  1.3  y  2.2 x  2.2  y  6 x  3.4  y  7.4 The format of each line in the

Display data in a repeater control, Which template must you provide, in ord...

Which template must you provide, in order to display data in a Repeater control? ItemTemplate.To display data in the ItemTemplate, declare one or more Web server controls and s

Functions carried out by different operating systems, Functions carried out...

Functions carried out by different operating systems The below is a list of functions carried out by different operating systems: - Provides a user interface - Device man

Define memory cycle time, Define memory cycle time? It is the time dela...

Define memory cycle time? It is the time delay needed between the initiations of two successive memory operations. Eg. The time among two successive read operations.

Why wap gateways are used, Why WAP gateways are used? The Wireless Appl...

Why WAP gateways are used? The Wireless Application Protocol Gateway is a very unique product giving semi -automatic redirection of HTML documents to WAP compatible mobile phon

Automated reasoning - first-order logic, Automated Reasoning - first-order ...

Automated Reasoning - first-order logic: The topic known as "Automated Reasoning" in "AI"concentrates mostly on deductive reasoning, here new facts are logically deduced from

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