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

Illustrate about fourth generation computers, Q. Illustrate about fourth ge...

Q. Illustrate about fourth generation computers? One of the main milestones in IC technology is Very large scale integration (VLSI) where thousands of transistors can be integr

Explain r-2r ladder d/a converter, Explain R-2R ladder D/A converter. A...

Explain R-2R ladder D/A converter. Ans. R-2R ladder D/A converter: An R-2R ladder D/A converter is shown in Fig.(a). It uses resistors of only two values R and 2R. The inp

Cookies for one page in your site, How do you turn off cookies for single p...

How do you turn off cookies for single page in your site? We can turn off the cookies for one page:- By setting the Cookie. Discard property false.

Find the boolean expression for the logic circuit, Find the boolean express...

Find the boolean expression for the logic circuit shown below. Ans. Output of Gate-1 (NAND) = (AB)' Output of Gate-2 (NOR) = (A'+B)' Output of Gate-3 (NOR) = [(AB)' + (

Explain one modulation technique used for high speed modems, Explain at lea...

Explain at least one modulation technique used for high speed modems. FSK - Frequency Shift Keying: In such technique the frequency of the carrier signal is changed as per to

State the use parameters and parameter definition modules, State the Use pa...

State the Use parameters and parameter definition modules. Parameters aren't preprocessor definitions and they have scope (for example parameters are associated with specific

What are the limitations of mobile devices, What are the limitations of mob...

What are the limitations of mobile devices? For mobile devices we require both PC-integrated applications and specialized mobile services quite than repurposed website content.

Explain the t flip flop, Explain the T Flip Flop? The toggle, or T, fli...

Explain the T Flip Flop? The toggle, or T, flip-flop is the bistable device that changes state on command from a common input terminal.   Truth Table

Source and destination are named the same, What happens if the both source ...

What happens if the both source and destination are named the same? Ans) The import operation present in MS Access does not overwrite or change any of the existing tables or obj

What is boot manager, An EFI boot manager is also used to select and load t...

An EFI boot manager is also used to select and load the operating system, removing the require for a dedicated boot loader mechanism

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