C examples for Statement:break
Use the break statement to exit for loop
#include <stdio.h> char s[] = "This is a test string. It contains two sentences."; int main( void ) { int count;/*from w w w .j a v a 2 s . c o m*/ printf("\nOriginal string: %s", s); for (count = 0; s[count]!='\0'; count++) { if (s[count] == '.') { s[count+1] = '\0'; break; } } printf("\nModified string: %s\n", s); return 0; }