Mega Code Archive

 
Categories / C / Code Snippets
 

Use getchar() in for loop

#include <stdio.h> #include <conio.h> int main(void) { char ch; for(ch = getchar(); ch != 'r'; ch = getchar()); printf("Found r."); return 0; }