What is a null statement in C? -


i want know exactly, null statement in c programming language? , explain typical use of it.

i found following segment of code.

for (j=6; j>0; j++) ; 

and

for (j=6; j>0; j++) 

from msdn page:

the "null statement" expression statement expression missing. useful when syntax of language calls statement no expression evaluation. consists of semicolon.

null statements commonly used placeholders in iteration statements or statements on place labels @ end of compound statements or functions.

know more: https://msdn.microsoft.com/en-us/library/1zea45ac.aspx


and explain typical use of it.

when want find index of first occurrence of character in string

int a[50] = "lord of rings"; int i;  for(i = 0; a[i] != 't'; i++)     ;//null statement //as no operation required 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -