online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 4 char **get_frase(int); char *get_parola(); void frase_to_file(char *, int, char *[], char *); int main(int argc, char *argv[]){ int tot_parole; char *frase; char *dataset[N] = {"franco", "mauro", "maria", "antonio"}; printf("tot parole: "); scanf("%d", &tot_parole); frase = get_frase(tot_parole); printf("ciao"); frase_to_file(frase, tot_parole, dataset, argv[1]); } char **get_frase(int tot_parole){ char **frase; frase = calloc(tot_parole, sizeof(char *)); for(int i=0; i<tot_parole; i++){ frase[i] = get_parola(); } return frase; } char *get_parola(){ char word[100]; //prova con * char *parola; printf("\nInserisci: "); scanf("%s", word); parola = calloc(strlen(word) + 1, sizeof(char)); strcpy(parola, word); return parola; } void frase_to_file(char *frase, int tot_parole, char *dataset[], char *file_name){ FILE *my_file = fopen(file_name, "w"); for(int i=0; i < tot_parole; i++){ for(int j=0; i<N; i++){ if(!strcmp(frase, dataset[j])){ fprintf(my_file, "%s\n", frase[i]); break; } } } fclose(my_file); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text



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