c - How does “continue" work in this code? -


while ( fgets(eqvline, 1024, eqvfile) != null ) {      eqvline[strlen(eqvline)-1] = '\0';      if (!strcmp (eqvline, "$signalmap")) {         start_store_mask = 1;         continue;     }      if (!strcmp (eqvline, "$signalmapend")) {         _num_mask_pins = i;         sim_inform ( sim, "[vtpsim] total of %d pins found in equivalent file.\n", _num_mask_pins);         //return;         start_store_mask = 0;     } } 

can explain how continue; in code works? when continue; executed, code jump to? again compare eqvline read new line? when code if (!strcmp (eqvline, "$signalmapend")) { called?

the continue statement passes control next iteration of nearest enclosing do, for, or while statement in appears, bypassing remaining statements in do, for, or while statement body.

in code, after continue; executed, condition while loop checked immediately.

if condition satisfied, control enters inside loop. first

 eqvline[strlen(eqvline)-1] = '\0'; 

is executed.

then, statement

 if (!strcmp (eqvline, "$signalmap")) 

is executed.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -