online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { // The Text const char * text = "Hello xyz world"; // The target word const char * patt = "world"; size_t textLen = strlen(text), pattLen = strlen(patt), i, j; for (i = 0; i < textLen - pattLen; i++) { // don't search if less that pattLen remains printf("%c", text[i]); if (text[i] == patt[0]) { // first char matches int found = 1; // be optimistic... for (j = 1; j < pattLen; j++) { if (patt[j] != text[i + j]) { found = 0; break; // does not fully match, go on } } if (found) { // yeah, a full match! printf(" <--"); // already printed first char for (j = 1; j < pattLen; j++) { printf("\n%c <--", patt[j]);// print all others chars from patt } i += pattLen - 1; // increase index... } } printf("\n"); } while (i < textLen) { printf("%c\n", text[i++]); // process the end of text } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue