criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.io.*;
import java.util.*;

public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str;

         
        while((str = br.readLine()) != null){
            String abcde = str;
            str = br.readLine();
            int num = Integer.parseInt(str);
            for(int i =0;i < num;i++){
                str = br.readLine();
                String[] temp = str.split("\\s");
                if(temp[0].equals("replace")){
                    //replace
                    int a = Integer.parseInt(temp[1]);
                    int b = Integer.parseInt(temp[2]);
                    String c = temp[3];
                    abcde = rep(abcde,a,b,c);

                }else if(temp[0].equals("reverse")){
                    //reverse
                    int a = Integer.parseInt(temp[1]);
                    int b = Integer.parseInt(temp[2]);
                    abcde = rev(abcde,a,b);

                }else{
                    //print
                    int a = Integer.parseInt(temp[1]);
                    int b = Integer.parseInt(temp[2]);                             
                    abcde = pr(abcde,a,b);
                    System.out.println(abcde);
                }
            }
        }
        br.close();
                  
    }

    public String rep(String abcde,int a,int b,String c){
        String x = abcde.substring(a,b+1);
        String ans = abcde.replace(x,c);
        return ans;
    }

    public String rev(String abcde,int a,int b){
        String x = abcde.substring(a,b+1);
        StringBuilder sb = new StringBuilder(x);
        sb.reverse();
        String y = sb.toString();
        String ans = abcde.replace(x,y);
        return ans;
    }

    public String pr(String abcde,int a,int b){
        String ans = abcde.substring(a,b+1);
        return ans;
    }




}

Compiler output:
Main.java:22: error: non-static method rep(String,int,int,String) cannot be referenced from a static context
                    abcde = rep(abcde,a,b,c);
                            ^
Main.java:28: error: non-static method rev(String,int,int) cannot be referenced from a static context
                    abcde = rev(abcde,a,b);
                            ^
Main.java:34: error: non-static method pr(String,int,int) cannot be referenced from a static context
                    abcde = pr(abcde,a,b);
                            ^
3 errors
Language: Java

import java.util.Scanner;

public class Main4 {

	static void print_ab( String str, int a, int b ) {
		System.out.println( str.substring( a, b+1 ) );
	}

	static String reverse_ab( String str, int a, int b ) {

		String rev_str = "";

		if ( a > 0 ) {
			rev_str = str.substring( 0, a );
		}

		for ( int i = b ; i > a-1 ; i-- ) {
			rev_str += str.charAt( i );
		}

		if ( b+1 < str.length() ) {
			rev_str += str.substring( b+1, str.length() );
		}

		return rev_str;
	}

	static String replace_ab( String str, int a, int b, String p_str ) {

		String rep_str = "";

		if ( a > 0 ) {
			rep_str = str.substring( 0, a );
		}

		rep_str += p_str;

		if ( b+1 < str.length() ) {
			rep_str += str.substring( b+1, str.length() );
		}

		return rep_str;
	}

	public static void main(String[] args) {

		int op_num = 0;
		int num1 = 0;
		int num2 = 0;

		String str = "";
		String p_str = "";
		String op = "";

		Scanner sc= new Scanner( System.in );

		str = sc.next();
		op_num = sc.nextInt();


		for ( int i = 0 ; i < op_num ; i++ ) {

			op = sc.next();

			switch(op) {
			case ("print"):
				num1 = sc.nextInt();
				num2 = sc.nextInt();
				print_ab( str, num1, num2 );
				break;
			case ("reverse"):
				num1 = sc.nextInt();
				num2 = sc.nextInt();
				str = reverse_ab( str, num1, num2 );
				break;
			case ("replace"):
				num1 = sc.nextInt();
				num2 = sc.nextInt();
				p_str = sc.next();
				str = replace_ab( str, num1, num2, p_str );
				break;
			}
		}
		sc.close();
	}
}


Compiler output:
Main.java:3: error: class Main4 is public, should be declared in a file named Main4.java
public class Main4 {
       ^
1 error
Language: Java

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner in = new Scanner(System.in);

	int a,b;
	String after;
	String str1,str2,str3;
	String str_rep;
	

	String str = in.next();
	int n = in.nextInt();

	for(int i=0;i<n;i++){
	    after = in.next();
	    a = in.nextInt();
	    b = in.nextInt();
	    if(after.equals("print")){
		for(int j=a;j<=b;j++){
		    System.out.print(str.charAt(j));
		}
		System.out.println();
	    }else if(after.equals("reverse")){
		str1 = str.substring(0,a);
		StringBuffer str2_buffer = new StringBuffer(str.substring(a,b+1));
		str2_buffer = str2_buffer.reverse();
		str2 = str2_buffer.substring(0);
		str3 = str.substring(b+1);
		str = str1+str2+str3;
	    }else if(after.equals("replace")){
		str1 = str.substring(0,a);
		str2 = str_rep;
		str3 = str.substring(b+1);
		str = str1+str2+str3;
	    }
	}
    }
}



Compiler output:
Main.java:34: error: variable str_rep might not have been initialized
		str2 = str_rep;
		       ^
1 error
Language: Java

public class ITP1_9_D {


	/**与えられた命令の列を実行するプログラム
	 *
	 * @param args0:文字列、1:実行コマンド数 2~：コマンド
	 */
	public static void main(String[] args){


		String target = args[0];
		int set_num = Integer.parseInt(args[1]);

		for(int k = 0,  action = 0; action < set_num;action++){
			String command = args[k + 2];

			int start,end;
			start = Integer.parseInt(args[k + 3]);
			end = Integer.parseInt(args[k + 4]) + 1;		//なぜ＋１しないといかんのかわからん



			switch(command){
			case "print":
				//指定されたインデックス番号の位置から終端までの文字列を返します。
				System.out.println(target.substring(start,end));
				 k =k + 3;
				break;

			case "replace":
				StringBuffer sb = new StringBuffer(new String(target));
				//sb.replace(start, end, args[5]);
			//	System.out.println(sb.replace(start,end,args[k+5]));
				target = sb.replace(start, end, args[k + 5]).toString();
				k = k + 4;
				break;

			case "reverse":

				//リバースする部分をとりだして（変数１）、反転した変数をつくる（変数２）
				//もとの文章に対して,もとの文章.replace(変数１、変数２）をプリントアウト
				String target_part = target.substring(start ,end );						//変数１
				StringBuffer reverse_part = new StringBuffer(new String(target_part));	//変数２
				reverse_part.reverse();
			//	System.out.println(target.replace(target_part, reverse_part));
				target = target.replace(target_part, reverse_part);
				 k = k + 3;
				break;

			default:
				break;

			}
		}


	}
}



Compiler output:
Main.java:1: error: class ITP1_9_D is public, should be declared in a file named ITP1_9_D.java
public class ITP1_9_D {
       ^
1 error
Language: C

#include<stdio.h>
#include<string.h>

int main()
{
 int a,i,j,b,c,k;
 char moji[1000],shiji[100],pri[100],scan[100];
 scanf("%s",moji);
 scanf("%d",&a);
 for(i=0;i<a;i++){
                     scanf("%s",shiji);
                           if(strcmp(shiji,"replace")==0){
                                                           scanf("%d%d%s",&b,&c,&rep);
                                                           for(j=0;j<c-b+1;j++){
                                                                          moji[b+j]=rep[j];
                                                                                }
                                                          }
                     if(strcmp(shiji,"reverse")==0){
                                                   scanf("%d%d", b,c);
                                                   for(;b<c;){
                                                              j=moji[b];
                                                              moji[b]=moji[c];
                                                              moji[c]=j;
                                                              b++;
                                                              c--;
                                                              }    
                                                     }         
                           
                     if(strcmp(shiji,"print")==0){         
                                                  scanf("%d%d",b,c);
                                                  for(k=0;k<c-b+1;k++);
                                                  pri[k]=moji[b+k];
                                                  printf("%s",&pri);
                                                  }
   return 0;

}


Compiler output:
main.c: In function 'main':
main.c:13:82: error: 'rep' undeclared (first use in this function)
   13 |                                                            scanf("%d%d%s",&b,&c,&rep);
      |                                                                                  ^~~
main.c:13:82: note: each undeclared identifier is reported only once for each function it appears in
main.c:37:1: error: expected declaration or statement at end of input
   37 | }
      | ^
Language: C

#include<stdio.h>
#include<string.h>

int main()
{
 int a,i,j,b,c,k;
 char moji[1000],shiji[100],rep[100],pri[100];
 scanf("%s",moji);
 scanf("%d",&a);
 for(i=0;i<a;i++){
                     scanf("%s",shiji);
                           if(strcmp(shiji,"replace")==0){
                                                           scanf("%d%d%s",&b,&c,&rep);
                                                           for(j=0;j<c-b+1;j++){
                                                                          moji[b+j]=rep[j];
                                                                                }
                                                          }
                     if(strcmp(shiji,"reverse")==0){
                                                   scanf("%d%d", b,c);
                                                   for(;b<c;){
                                                              j=moji[b];
                                                              moji[b]=moji[c];
                                                              moji[c]=j;
                                                              b++;
                                                              c--;
                                                              }    
                                                     }         
                           
                     if(strcmp(shiji,"print")==0){         
                                                  scanf("%d%d",b,c);
                                                  for(k=0;k<c-b+1;k++);
                                                  pri[k]=moji[b+k];
                                                  printf("%s",&pri);
                                                  }
   return 0;

}


Compiler output:
main.c: In function 'main':
main.c:37:1: error: expected declaration or statement at end of input
   37 | }
      | ^
Language: C

#include<stdio.h>
#include<string.h>

int main()
{
 int a,i,j,b,c,k;
 char moji[1000],shiji[100],rep[100],pri[100];
 scanf("%s",moji);
 scanf("%d",&a);
 for(i=0;i<a;i++){
                     scanf("%s",shiji);
                     if(strcmp(shiji,"replace")==0){
                                                     scanf("%d%d%s",&b,&c,&rep);
                                                     for(j=0;j<c-b+1;j++){
                                                                          moji[b+j]=rep[j];
                                                                          }
                                                    }
                     if(strcmp(shiji,"reverse")==0){
                                                   scanf("%d%d",&b,&c);
                                                   for(;b<c;){
                                                              j=moji[b];
                                                              moji[b]=moji[c];
                                                              moji[c]=j;
                                                              b++;
                                                              c--;
                                                              }    
                                                     }         
                           
                     if(strcmp(shiji,"print")==0){         
                                                  scanf("%d%d",&b,&c);
                                                  for(k=0;k<c-b+1;k++);
                                                  print("%c",moji[k]);
                                                  printf("\n");
                                                  }

                     }
   return 0;

}


Compiler output:
main.c: In function 'main':
main.c:32:51: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   32 |                                                   print("%c",moji[k]);
      |                                                   ^~~~~
      |                                                   printf
Language: C

#include<stdio.h>
#include<string.h>

int main()
{
 int a,i,j,b,c,k;
 char moji[1000],shiji[100],rep[100],pri[100];
 scanf("%s",moji);
 scanf("%d",&a);
 for(i=0;i<a;i++){
                     scanf("%s",shiji);
                     if(strcmp(shiji,"replace")==0){
                                                     scanf("%d%d%s",&b,&c,&rep);
                                                     for(j=0;j<c-b+1;j++){
                                                                          moji[b+j]=rep[j];
                                                                          }
                                                    }
                     if(strcmp(shiji,"reverse")==0){
                                                   scanf("%d%d",&b,&c);
                                                   for(;b<c;){
                                                              j=moji[b];
                                                              moji[b]=moji[c];
                                                              moji[c]=j;
                                                              b++;
                                                              c--;
                                                              }    
                                                     }         
                           
                     if(strcmp(shiji,"print")==0){         
                                                  scanf("%d%d",&b,&c);
                                                  for(k=0;k<c-b+1;k++){
                                                  print("%c",moji[k]);}
                                                  printf("\n");
                                                  }

                     }
   return 0;

}


Compiler output:
main.c: In function 'main':
main.c:32:51: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   32 |                                                   print("%c",moji[k]);}
      |                                                   ^~~~~
      |                                                   printf
Language: C

#include<stdio.h>
#include<string.h>

int main()
{
 int a,i,j,b,c,k;
 char moji[1000],shiji[100],rep[100],pri[100];
 scanf("%s",moji);
 scanf("%d",&a);
 for(i=0;i<a;i++){
                     scanf("%s",shiji);
                     if(strcmp(shiji,"replace")==0){
                                                     scanf("%d%d%s",&b,&c,&rep);
                                                     for(j=0;j<c-b+1;j++){
                                                                          moji[b+j]=rep[j];
                                                                          }
                                                    }
                     if(strcmp(shiji,"reverse")==0){
                                                   scanf("%d%d",&b,&c);
                                                   for(;b<c;){
                                                              j=moji[b];
                                                              moji[b]=moji[c];
                                                              moji[c]=j;
                                                              b++;
                                                              c--;
                                                              }    
                                                     }         
                           
                     if(strcmp(shiji,"print")==0){         
                                                  scanf("%d%d",&b,&c);
                                                  for(k=b;k<c+1;k++){
                                                  print("%c",moji[k]);
                                                                    }
                                                  printf("\n");
                                                  }

                     }
   return 0;

}


Compiler output:
main.c: In function 'main':
main.c:32:51: error: implicit declaration of function 'print'; did you mean 'printf'? [-Wimplicit-function-declaration]
   32 |                                                   print("%c",moji[k]);
      |                                                   ^~~~~
      |                                                   printf
Language: C

#include <stdio.h>
#include <string.h>
char t1[1510];
char t2[1510];
char t3[1510];
int main(){
    int n;
    int a,b;
    int i,j;
    char t;
    scanf("%s",&t1);
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s",&t3);
        if(strcmp(t3,"replace")==0){
            scanf("%d %d %s",&a,&b,&t2);
            for(j=0;j<b-a+1;j++){
                t1[a+j]=t2[j];
            }
        }
        else if(strcmp(t3,"reverse")==0){
            scanf("%d %d",&a,&b);
            for(;b<c;){
                t=t1[a];
                t1[a]=t1[b];
                t1[b]=t;
                a++;
                b--;
            }
        }
        else if(strcmp(t3,"print")==0){
            scanf("%d %d",&a,&b);
            for(j=a;j<b+1;j++){
                printf("%c",t1[j]);
            }
             printf("\n");
        }
    }
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:23:20: error: 'c' undeclared (first use in this function)
   23 |             for(;b<c;){
      |                    ^
main.c:23:20: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <studio.h>

int main(){
    double pai=3.141592653589;
    int n,a,b;
    char c[1000],rc[1000],s[10];
    scanf("%s",&c);
    scanf("%d",&n);
    string w;
    for(int i=0;i<n;i++){
        scanf("%s",&s);
        w=s;
        if(w=="print"){
            scanf("%d %d",&a,&b);
            for(int i=a;i<=b;i++){
                printf("%c",c[i]);
            }
            printf("\n");
        }else if(w=="replace"){
            scanf("%d %d %s",&a,&b,&rc);
            int j=0;
            for(int i=a;i<=b;i++){
                c[i]=rc[j];
                j++;
            }
        }else{
            scanf("%d %d",&a,&b);
            int j=b;
            strcpy(rc,c);
            for(int i=a;i<=b;i++){
                c[i]=rc[j];
                j--;
            }
        }
    }
    return 0;
}


Compiler output:
main.c:1:10: fatal error: studio.h: No such file or directory
    1 | #include <studio.h>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <studio.h>
int main(void)
{
    double pai=3.141592653589;
    int n,a,b;
    char c[1000],rc[1000],s[10];
    scanf("%s",&c);
    scanf("%d",&n);
    string w;
    for(int i=0;i<n;i++){
        scanf("%s",&s);
        w=s;
        if(w=="print"){
            scanf("%d %d",&a,&b);
            for(int i=a;i<=b;i++){
                printf("%c",c[i]);
            }
            printf("\n");
        }else if(w=="replace"){
            scanf("%d %d %s",&a,&b,&rc);
            int j=0;
            for(int i=a;i<=b;i++){
                c[i]=rc[j];
                j++;
            }
        }else{
            scanf("%d %d",&a,&b);
            int j=b;
            strcpy(rc,c);
            for(int i=a;i<=b;i++){
                c[i]=rc[j];
                j--;
            }
        }
    }
    return 0;
}


Compiler output:
main.c:1:10: fatal error: studio.h: No such file or directory
    1 | #include <studio.h>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
    string s, c, p;
    int q, a, b;

    cin >> s >> q;

    while (q-- && cin >> c) {
        cin >> a >> b;
        int size = b - a + 1;
        if (c == "print")
            cout << s.substr(a, size) << endl;
        else if (c == "reverse") {
            string st = s.substr(a, size);
            reverse(st.begin(), st.end());
            s = s.replace(a, size, st);
        } else {
            cin >> p;
            s = s.replace(a, size, p);
        }
    }

    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
	string s, c, p;
	int q, a, b;

	cin >> s >> q;
	while (q--) {
		cin >> c >> a >> b;
		int l = b - a + 1;
		if (c == "print")
			cout << s.substr(a, l) << endl;
		else if (c == "reverse")
			reverse(s.begin() + a, s.begin() + b + 1);
		else {
			cin >> p;
			s = s.replace(a, l, p);
		}
	}

	return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
	string s, c, p;
	int q, a, b;

	cin >> s >> q;
	while (q--)
 {
		cin >> c >> a >> b;
		int l = b - a + 1;
		if (c == "print")
			cout << s.substr(a, l) << endl;
		else if (c == "reverse")
			reverse(s.begin() + a, s.begin() + b + 1);
		else 
{
			cin >> p;
			s = s.replace(a, l, p);
		}
	}

	return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(void)
{
	string s, c, p;
	int q, a, b;

	cin >> s >> q;
	while (q--)
 {
		cin >> c >> a >> b;
		int l = b - a + 1;
		if (c == "print")
			cout << s.substr(a, l) << endl;
		else if (c == "reverse")
			reverse(s.begin() + a, s.begin() + b + 1);
		else 
{
			cin >> p;
			s = s.replace(a, l, p);
		}
	}

	return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
using namespace std;


int main() {
    string str,op,rstr;
    int q,a,b,i;
    cin >> str >> q;
    for (i=0;i<q;i++) {
        cin >> op >> a >> b;
        if (op == "print") {
            cout << str.substr(a, b-a+1) << endl;
        } else if (op == "reverse") {
            rstr = str.substr(a, b-a+1);
            for (int j=0;j<b-a+1;j++) {
                str[a+j] = rstr[b-a-j];
            }
        } else if (op == "replace") {
            cin >> rstr;
            str.replace(a, b-a+1, rstr);
        }
    }
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <string.h>
 
void print(char* str){
    int i, a,b;
    scanf("%d%d", &a, &b);
    for(i = a; b >= i; i++){
        printf("%c", str[i]);
    }
    printf("\n");
}
void reverse(char* str){
    char buf[1000];
    int a,b,i, c = 0;
    scanf("%d%d", &a, &b);
    for(i = a; b >= i; i++){
        buf[c] = str[i];
        c++;
    }
    c = 0;
    for(i = a; b >= i; i++){
        str[i] = buf[(b-a)-c];
        c++;
    }
}
void replace(char* str){
    char buf[1000];
    int a,b,i, c = 0;
    scanf("%d%d%s", &a, &b, buf);
    for(i = a; b >= i; i++){
        str[i] = buf[c];
        c++;
    }
}
int main(void) {
    char str[1000];
    int n, i;
     
    scanf("%s%d", str, &n);
    for(i = 0; n > i; i++){
        char me[8];
        scanf("%s", me);
        if(!strcmp(me, "print"))
            print(str);
        else if(!strcmp(me, "reverse"))
            reverse(str);
        else if(!strcmp(me, "replace"))
            replace(str);
    }
     
    return 0;



Compiler output:
main.c: In function 'main':
main.c:51:5: error: expected declaration or statement at end of input
   51 |     return 0;
      |     ^~~~~~
Language: C

#include<stdio.h>
#include<string.h>

int main(){
	char str[1001];		//入力される文字列
	int q;				//命令の数
	char order[8];		//命令用文字列
	char substr[1001];	//作業用文字列
	int a,b;			//命令用の数字
	char x;				//入れ替え用文字
	
	//最初の入力
	scanf("%s",str);
	scanf("%d",&q);
	
	for(int i = 0;i < q;i++){
		scanf("%s",order);
		
		//出力
		if(strcmp(order,"print") == 0){
			//数字の入力
			scanf("%d",&a);
			scanf("%d",&b);
			//出力範囲の取り出し
			strncpy(substr,str[a],b - a + 1);
			printf("%s\n",substr);
		}
		//逆順
		else if(strcmp(order,"reverse") == 0){
			//数字の入力
			scanf("%d",&a);
			scanf("%d",&b);
			strncpy(substr,str[a],b - a + 1);
			//インクリメント用変数
			int inc = 0;
			//デクリメント用変数
			int dec = b - 1;
			
			//入れ替え処理
			while(1){
				//入れ替える文字列の中央まで来たら抜ける
				if (inc >= dec){
					break;
				}
				x =str[dec];
				str[dec] = substr[inc];
				substr[inc] = x;
				rev++;
				dec--;
			}
		}
		//置換
		else if(strcmp(order,"replace") == 0){
			//数字と文字列の入力
			scanf("%d",&a);
			scanf("%d",&b);
			char p[b - a + 2];	//置換用文字列
			scanf("%s",p);
			//置換する
			strncpy(str[a],p,b - a + 1);
		}
	}
	return 0;
}



Compiler output:
main.c: In function 'main':
main.c:25:43: error: passing argument 2 of 'strncpy' makes pointer from integer without a cast [-Wint-conversion]
   25 |                         strncpy(substr,str[a],b - a + 1);
      |                                        ~~~^~~
      |                                           |
      |                                           char
In file included from main.c:2:
/usr/include/string.h:145:46: note: expected 'const char * restrict' but argument is of type 'char'
  145 |                       const char *__restrict __src, size_t __n)
      |                       ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
main.c:33:43: error: passing argument 2 of 'strncpy' makes pointer from integer without a cast [-Wint-conversion]
   33 |                         strncpy(substr,str[a],b - a + 1);
      |                                        ~~~^~~
      |                                           |
      |                                           char
/usr/include/string.h:145:46: note: expected 'const char * restrict' but argument is of type 'char'
  145 |                       const char *__restrict __src, size_t __n)
      |                       ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
main.c:48:33: error: 'rev' undeclared (first use in this function)
   48 |                                 rev++;
      |                                 ^~~
main.c:48:33: note: each undeclared identifier is reported only once for each function it appears in
main.c:60:36: error: passing argument 1 of 'strncpy' makes pointer from integer without a cast [-Wint-conversion]
   60 |                         strncpy(str[a],p,b - a + 1);
      |                                 ~~~^~~
      |                                    |
      |                                    char
/usr/include/string.h:144:40: note: expected 'char * restrict' but argument is of type 'char'
  144 | extern char *strncpy (char *__restrict __dest,
      |                       ~~~~~~~~~~~~~~~~~^~~~~~
Language: C

#include<stdio.h>
#include<string.h>

#define SIZE 2000

void replace(char str[], int a, int b, char rep[])
{
  int p = (b - a) + 1;
  int i;
  for(i = 0; i < p; i++){
    str[a+i] = rep[i];
  }
  return;
}

void reverse(char str[], int a, int b)
{
   int i, j, w;
   i = a;
   j = b;
   while(i < j){
     w = str[i];
     str[i] = str[j];
     str[j] = w;
     i++;
     j--;
   }
   return;
}

void print(char str[], int a, int b)
{
  int i;
  for(i = a; i <= b; i++){
    putchar(str[i]);
  }
  putchar('\n');
  return;
}

int main(void)
{

  char str[SIZE], cmds[100][SIZE], cmd[SIZE],rep[SIZE];
  int a, b, q, i;

  scanf("%s", str);
  scanf("%d", q);

  for(i = 0; i < q; i++){
    scanf("%[^\n]", cmds[i]);
  }

  for(i = 0; i < q; i++){
    sscanf(cmds[i], "%s", cmd);
    if(strcmp(cmd, "replace") == 0){
      sscanf(cmds, "%s%d%d%s", cmd, a, b, rep);
      replace(str, a, b, rep);
    }else if(strcmp(cmd, "reverse") == 0)){
      sscanf(cmds, "%s%d%d", cmd, a, b);
      reverse(str, a, b);
    }else if(strcmp(cmd, "print") == 0)){
      sscanf(cmds, "%s%d%d", cmd, a, b);
      print(str, a, b);
    }else{
    }
  }

  return(0);
}

Compiler output:
main.c: In function 'main':
main.c:57:14: error: passing argument 1 of 'sscanf' from incompatible pointer type [-Wincompatible-pointer-types]
   57 |       sscanf(cmds, "%s%d%d%s", cmd, a, b, rep);
      |              ^~~~
      |              |
      |              char (*)[2000]
In file included from main.c:1:
/usr/include/stdio.h:430:43: note: expected 'const char *' but argument is of type 'char (*)[2000]'
  430 | extern int sscanf (const char *__restrict __s,
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~
main.c:59:42: error: expected statement before ')' token
   59 |     }else if(strcmp(cmd, "reverse") == 0)){
      |                                          ^
main.c:60:14: error: passing argument 1 of 'sscanf' from incompatible pointer type [-Wincompatible-pointer-types]
   60 |       sscanf(cmds, "%s%d%d", cmd, a, b);
      |              ^~~~
      |              |
      |              char (*)[2000]
/usr/include/stdio.h:430:43: note: expected 'const char *' but argument is of type 'char (*)[2000]'
  430 | extern int sscanf (const char *__restrict __s,
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~
main.c:62:6: error: 'else' without a previous 'if'
   62 |     }else if(strcmp(cmd, "print") == 0)){
      |      ^~~~
main.c:62:40: error: expected statement before ')' token
   62 |     }else if(strcmp(cmd, "print") == 0)){
      |                                        ^
main.c:63:14: error: passing argument 1 of 'sscanf' from incompatible pointer type [-Wincompatible-pointer-types]
   63 |       sscanf(cmds, "%s%d%d", cmd, a, b);
      |              ^~~~
      |              |
      |              char (*)[2000]
/usr/include/stdio.h:430:43: note: expected 'const char *' but argument is of type 'char (*)[2000]'
  430 | extern int sscanf (const char *__restrict __s,
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~
main.c:65:6: error: 'else' without a previous 'if'
   65 |     }else{
      |      ^~~~
Language: C

#include <stdio.h>

int main () {
  int i,j,num,a,b;
  char str[101],tem[101],com[20];

  scanf("%s",str);
  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%s %d %d",com,&a,&b);
    if(com[0]=='p'){
      for(j=a;j<=b;j++) printf("%c",str[j]);
      printf("\n");
    }
    else if(com[2]=='p')==0){
      scanf("%s",tem);
      for(j=a;j<=b;j++) str[j]=tem[j-a];
    }
    else if(com[2]=='v'){
      for(j=a;j<=b;j++) tem[j]=str[j];
      for(j=a;j<=b;j++) str[j]=tem[b-(j-a)];
    }
  }
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:25: error: expected expression before '==' token
   16 |     else if(com[2]=='p')==0){
      |                         ^~
main.c:16:28: error: expected statement before ')' token
   16 |     else if(com[2]=='p')==0){
      |                            ^
main.c:20:5: error: 'else' without a previous 'if'
   20 |     else if(com[2]=='v'){
      |     ^~~~
Language: C

#include <stdio.h>
#include <string.h>

void swap(char *a,char *b){
	char c = *a;
	*a = *b;
	*b = c;
}

void parser(char s[]){
	char dir[8],p[1000],buf;
	int a,b,i,j;

	for(i=0;i<n;i++){
		scanf("%s",dir);
		if(!strcmp(dir,"print")){
			scanf("%d %d",&a,&b);
			while(a<=b)putchar(s[a++]);
			putchar('\n');
		}
		else if(!strcmp(dir,"reverse")){
			scanf("%d %d",&a,&b);
			while(b>a)swap(&s[a++],&s[b--]);
		}
		else if(!strcmp(dir,"replace")){
			scanf("%d %d %s",&a,&b,p);
			j=0;
			while(j<(b-a+1))s[j+a]=p[j],j++;
		}
	}
}

int main(){
	char s[1000];
	int i,n;
	scanf("%s",s);
	scanf("%d",&n);
	parser(s,n);
	return 0;
}

Compiler output:
main.c: In function 'parser':
main.c:14:19: error: 'n' undeclared (first use in this function)
   14 |         for(i=0;i<n;i++){
      |                   ^
main.c:14:19: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:38:9: error: too many arguments to function 'parser'
   38 |         parser(s,n);
      |         ^~~~~~
main.c:10:6: note: declared here
   10 | void parser(char s[]){
      |      ^~~~~~
Language: C

#include <stdio.h>
#include "stdafx.h"
#include <string.h>
#include <ctype.h>

typedef struct {
	char *op_name;
	int (*funcptr)(char *str_p,int a,int b,char *p_p);
}CNTRL_T;


int func_print(char *str_p,int a,int b,char *p_p)
{
	int i;

	for (i=a ; i<=b ; i++) {
		printf("%c",str_p[i]);
	}
	printf("\n");

	return 0;
}
int func_rev(char *str_p,int a,int b,char *p_p)
{
	int i;
	int idx=0;
	char wk[16];

	for (i=a ; i<=b ; i++) {
		wk[idx] = str_p[i];
		idx++;
	}
	idx--;
	for (i=a ; i<=b ; i++) {
		str_p[i] = wk[idx];
		idx--;
	}

	return 0;
}
int func_rep(char *str_p,int a,int b,char *p_p)
{
	int i;
	int idx=0;

	for (i=a ; i<=b ; i++) {
		str_p[i] = p_p[idx];
		idx++;
	}

	return 0;
}


CNTRL_T	ctrl[] = {
 {"print",func_print},
 {"reverse",func_rev},
 {"replace",func_rep},
 {NULL,NULL}
};

int main()
{
	int  q;
	char str[1000];
	char op[16];
	int	 a;
	int  b;
	int  i,k;
	char p[16];
	char inp[64];


printf("%d",sizeof(str));
	gets(inp);
	sscanf(inp,"%s",str);
	gets(inp);
	sscanf(inp,"%d",&q);


	for (i=0 ; i<q ; i++) {
		gets(inp);
		sscanf_s(inp,"%s %d %d %s",&(op[0]),&a,&b,&(p[0]));


		for(k=0 ; ctrl[k].op_name != NULL ; k++) {
			if (strcmp(&(op[0]), ctrl[k].op_name)==0) {
				ctrl[k].funcptr(&(str[0]),a,b,&(p[0]));
			}
		}

	}
	return 0;
}

Compiler output:
main.c:2:10: fatal error: stdafx.h: No such file or directory
    2 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
#include <string.h>
#include <ctype.h>

typedef struct {
	char *op_name;
	int (*funcptr)(char *str_p,int a,int b,char *p_p);
}CNTRL_T;


int func_print(char *str_p,int a,int b,char *p_p)
{
	int i;

	for (i=a ; i<=b ; i++) {
		printf("%c",str_p[i]);
	}
	printf("\n");

	return 0;
}
int func_rev(char *str_p,int a,int b,char *p_p)
{
	int i;
	int idx=0;
	char wk[16];

	for (i=a ; i<=b ; i++) {
		wk[idx] = str_p[i];
		idx++;
	}
	idx--;
	for (i=a ; i<=b ; i++) {
		str_p[i] = wk[idx];
		idx--;
	}

	return 0;
}
int func_rep(char *str_p,int a,int b,char *p_p)
{
	int i;
	int idx=0;

	for (i=a ; i<=b ; i++) {
		str_p[i] = p_p[idx];
		idx++;
	}

	return 0;
}


CNTRL_T	ctrl[] = {
 {"print",func_print},
 {"reverse",func_rev},
 {"replace",func_rep},
 {NULL,NULL}
};

int main()
{
	int  q;
	char str[1000];
	char op[16];
	int	 a;
	int  b;
	int  i,k;
	char p[16];
	char inp[64];


printf("%d",sizeof(str));
	gets(inp);
	sscanf(inp,"%s",str);
	gets(inp);
	sscanf(inp,"%d",&q);


	for (i=0 ; i<q ; i++) {
		gets(inp);
		sscanf_s(inp,"%s %d %d %s",&(op[0]),&a,&b,&(p[0]));


		for(k=0 ; ctrl[k].op_name != NULL ; k++) {
			if (strcmp(&(op[0]), ctrl[k].op_name)==0) {
				ctrl[k].funcptr(&(str[0]),a,b,&(p[0]));
			}
		}

	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:74:9: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   74 |         gets(inp);
      |         ^~~~
      |         fgets
main.c:82:17: error: implicit declaration of function 'sscanf_s'; did you mean 'sscanf'? [-Wimplicit-function-declaration]
   82 |                 sscanf_s(inp,"%s %d %d %s",&(op[0]),&a,&b,&(p[0]));
      |                 ^~~~~~~~
      |                 sscanf
Language: C

#include <stdio.h>
#include <string.h>

int main(void){
  char word[1010],temp[10],p[1010];
  int i,j,k,t,a,b,trial;

  scanf("%s",word);  scanf("%d",&trial);
  for(i=0;i<trial;i++){
    scanf("%s",temp);
    if(strcmp(temp,"print")==0){
      scanf("%d%d",&a,&b);
      for(j=a;j<=b;j++)  printf("%c",word[j]);
      printf("\n");
    } else if(strcmp(temp,"reverse")==0) {
      scanf("%d%d",&a,&b);
      for(j=a,k=b;j<=k;j++,k--){
        temp=word[a];
        word[a]=word[b];
        word[b]=t;
      }
    } else if(strcmp(temp,"replace")==0) {
      scanf("%d%d",&a,&b);  scanf("%s",p);
      for(j=a;j<=b;j++)  word[j]=p[j-a];
    }
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:18:13: error: assignment to expression with array type
   18 |         temp=word[a];
      |             ^
Language: C

#include <stdio.h>
#include <string.h>

int
main()
{
	char str[1001];
	scanf("%s", str);

	int n_orders;
	scanf("%d", &n_orders);

	char order[10];
	char p[1001];
	int a, b;
	int ni, si;
	for (ni = 0; ni < n_orders; ni++)
	{
		scanf("%s", order);
		if (strcmp(order, "print") == 0)
		{
			scanf("%d %d", &a, &b);
			for (si = a; si <= b; si++)
			{
				putchar(str[si]);
			}
			putchar('\n');
			continue;
		}
		if (strcmp(order, "reverse") == 0)
		{
			scanf("%d %d", &a, &b);
			for (si = a; si <= a+(b-a)/2; si++)
			{
				str[si] = str[a+b-si]
			}
			continue;
		}
		if (strcmp(order, "replace") == 0)
		{
			scanf("%d %d %s", &a, &b, p);
			for (si = a; si <= b; si++)
			{
				str[si] = p[si-a];
			}
			continue;
		}
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:35:54: error: expected ';' before '}' token
   35 |                                 str[si] = str[a+b-si]
      |                                                      ^
      |                                                      ;
   36 |                         }
      |                         ~
Language: C

#include <stdio.h>
#include <stdlib.h>
int main(void){
	char a[1001],c[101],f[1001],m[1001],g[] = "point",h[] = "replace",l[] = "reverse";
	int b,d,e,i,j;
	scanf("%s",&a);
	scanf("%d",&b);
	for(i=0;i<b;i++){
		scanf("%s %d %d",&c,&d,&e);
		if(strcmp(c,g)==0){
			for(j=d;j<=e;j++)
				printf("%c",a[j]);a
			printf("\n");}
		if(strcmp(c,h)==0){
			scanf("%s",&f);
			for(j=d;j<=e;j++)
				a[j] = f[j];}
		if(strcmp(c,l)==0){
			for(j=e;j<=d;j--)
				m[j] = a[j];
			for(j=d;j<=e;j++)
				a[j] = m[j];}
	}
	return 0;
}
			

Compiler output:
main.c: In function 'main':
main.c:10:20: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
   10 |                 if(strcmp(c,g)==0){
      |                    ^~~~~~
main.c:3:1: note: include '<string.h>' or provide a declaration of 'strcmp'
    2 | #include <stdlib.h>
  +++ |+#include <string.h>
    3 | int main(void){
main.c:12:52: error: expected ';' before 'printf'
   12 |                                 printf("%c",a[j]);a
      |                                                    ^
      |                                                    ;
   13 |                         printf("\n");}
      |                         ~~~~~~
Language: C

#include <stdio.h>
#include <string.h>

int main(void)
{
  char str[1001];
  int n;
  char com[1001];
  int a, b;
  char ch[1001];
  int i, j, k;
  char t;

  scanf("%s", str);

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%s %d %d", com, &a, &b);
    
    if(strcmp(com, "print") == 0)
      for(j = a; j <= b; j++)
	printf("%c", str[j]);
    
    if((com, "reverse") == 0)
      for(j = 0; j <= (a + b) / 2; j++){
	t = str[a + j];
	str[a + j] = str[b - j];
	str[b - j] = str[a + j];
      }
    
    if(strcmp(com, "replace") == 0){
      scanf("%s", ch)
      for(j = a, k = 0; j <= b; j++, k++)
	str[a + j] = ch[k];
    }
  }

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:33:22: error: expected ';' before 'for'
   33 |       scanf("%s", ch)
      |                      ^
      |                      ;
   34 |       for(j = a, k = 0; j <= b; j++, k++)
      |       ~~~
Language: C

#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(int argc, const char * argv[]) {
	
	int n,taro_p=0,hanako_p=0,i;
	
	
	
	scanf("%d",&n);
	
	for(i = 0 ; i  < n; i++) {
		
		char taro_card[101],hanako_card[101];
		scanf("%s",taro_card);
		scanf("%s",hanako_card);
		
		int cmp=strcmp(taro_card,hanako_card);

		if(cmp == 0) {
			taro_p += 1;
			hanako_p += 1;
			//printf("drow\n");
		} else if (cmp == 1) {
			taro_p += 3;
		} else {
			hanako_p +=3
		}
			
	}	
	printf("%d %d\n",taro_p,hanako_p);	
	return 0;
	
}

Compiler output:
main.c: In function 'main':
main.c:28:37: error: expected ';' before '}' token
   28 |                         hanako_p +=3
      |                                     ^
      |                                     ;
   29 |                 }
      |                 ~
Language: C

#include<stdio.h>
#include<string.h>
??
int main(void){
	char s[1010],m[100],c[1010],p[1010];
	int q,i,j,a,b;
	scanf("%s %d",s,&q);	/*????????????????????????????????°*/
	strcpy(c,s);		/*??????????????????*/
	for(i=0;i<q;i++){
	scanf("%s",m);		/*??????????????????*/
	if(strcmp(m,"print")==0){	/*??????*/
		scanf("%d %d",&a,&b);
		for(j=a;j<=b;j++){
			printf("%c",s[j]);
			}
		strcpy(c,s);	/*??????????????????*/
		printf("\n");
		}
		if(strcmp(m,"reverse")==0){	/*??????*/
		scanf("%d %d",&a,&b);
		for(j=a;j<=b;j++){
		s[j]=c[b-j+a];		/*??????*/
		}
		strcpy(c,s);	/*??????????????????*/
		}
		if(strcmp(m,"replace")==0){		/*??????*/	
		scanf("%d %d %s",&a,&b,p);
		for(j=a;j<=b;j++){
		s[j]=p[j-a];		/*????????????*/
		}
		strcpy(c,s);	/*??????????????????*/
		}
	}
	return 0;
}

Compiler output:
main.c:3:1: error: expected identifier or '(' before '?' token
    3 | ??
      | ^
Language: C

"#include <stdio.h>
#include <string.h>
int main(){
char str[1000],mei[10],q[1000],aaa[1000];
int kazu,a,b,d,i,j,l;



scanf("%s",str);






scanf("%d",&kazu);
for(i=0;i<kazu;i++){



scanf("%s %d %d",mei,&a,&b);

if(mei[2]=='p'){scanf(%s,q);
for(j=0;j<b-a+1;j++){str[j+a]=q[j];}}


else if(mei[0]=='p'){for(i=a;i<b+1;i++){
printf("%s",str[i]);}}

else {

for(j=a;j<b+1;j++){
aaa[j]=str[j];}

d=a;
for(j=b+1;j>=a;j--){
str[j]=aaa[d];
d++
}



}




return 0;
}

Compiler output:
main.c:1:1: warning: missing terminating " character
    1 | "#include <stdio.h>
      | ^
main.c:1:1: error: missing terminating " character
    1 | "#include <stdio.h>
      | ^~~~~~~~~~~~~~~~~~~
main.c: In function 'main':
main.c:9:1: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    9 | scanf("%s",str);
      | ^~~~~
main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
    2 | #include <string.h>
  +++ |+#include <stdio.h>
    3 | int main(){
main.c:9:1: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    9 | scanf("%s",str);
      | ^~~~~
main.c:9:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:23:23: error: expected expression before '%' token
   23 | if(mei[2]=='p'){scanf(%s,q);
      |                       ^
main.c:28:1: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   28 | printf("%s",str[i]);}}
      | ^~~~~~
main.c:28:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:28:1: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:28:1: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:38:4: error: expected ';' before '}' token
   38 | d++
      |    ^
      |    ;
   39 | }
      | ~   
main.c:49:1: error: expected declaration or statement at end of input
   49 | }
      | ^
Language: C

#include <stdio.h>
#include <string.h>
int main(){
char str[1000],mei[10],q[1000],aaa[1000];
int kazu,a,b,d,i,j,l;



scanf("%s",str);






scanf("%d",&kazu);
for(i=0;i<kazu;i++){



scanf("%s %d %d",mei,&a,&b);

if(mei[2]=='p'){scanf(%s,q);
for(j=0;j<b-a+1;j++){str[j+a]=q[j];}}


else if(mei[0]=='p'){for(i=a;i<b+1;i++){
printf("%s",str[i]);}}

else {

for(j=a;j<b+1;j++){
aaa[j]=str[j];}

d=a;
for(j=b+1;j>=a;j--){
str[j]=aaa[d];
d++;
}



}


}

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:23: error: expected expression before '%' token
   23 | if(mei[2]=='p'){scanf(%s,q);
      |                       ^
Language: C

#include <stdio.h>
#include <string.h>
int main(){
char str[1000],mei[10],q[1000],aaa[1000];
int kazu,a,b,d,i,j,l;



scanf("%s",str);






scanf("%d",&kazu);
for(i=0;i<kazu;i++){



scanf("%s %d %d",mei,&a,&b);

if(mei[2]=='p'){scanf(%s,q);
for(j=0;j<b-a+1;j++){str[j+a]=q[j];}}


else if(mei[0]=='p'){for(i=a;i<b+1;i++){
printf("%s",str[i]);}}

else {

for(j=a;j<b+1;j++){
aaa[j]=str[j];}


for(j=b+1;j>=a;j--){
d=a;
str[j]=aaa[d];
d++;
}



}


}

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:23: error: expected expression before '%' token
   23 | if(mei[2]=='p'){scanf(%s,q);
      |                       ^
Language: C

#include <stdio.h>
#include <string.h>
int main(){
char str[1000],mei[10],q[1000],aaa[1000];
int kazu,a,b,d,j;



scanf("%s",str);



scanf("%d",&kazu);



for(i=0;i<kazu;i++){



scanf("%s %d %d",mei,&a,&b);

if(mei[2]=='p'){scanf("%s",q);
for(i=0;i<b-a+1;i++){str[i+a]=q[i];}}


else if(mei[0]=='p'){for(i=a;i<b+1;i++){
printf("%s",str[i]);}printf("\n");}








else if(mei[2]=='v'){
strcpy(aaa,str);
for(j=b+1,d=a;j>=a;j--,d++){
str[j]=aaa[d];
}

}








}

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:5: error: 'i' undeclared (first use in this function)
   17 | for(i=0;i<kazu;i++){
      |     ^
main.c:17:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
#include <string.h>
int main(){
char str[1000],mei[10],q[1000],aaa[1000]={0};
int kazu,a,b,d,j,i,ba;



scanf("%s",str);



scanf("%d",&kazu);



for(i=0;i<kazu;i++){



scanf("%s %d %d",mei,&a,&b);

if(mei[2]=='p'){scanf("%s",q);
for(i=0;i<b-a+1;i++){str[i+a]=q[i];}}


if(mei[0]=='p'){for(i=a;i<b+1;i++){
printf("%c",str[i]);}printf("\n");}




if(mei[2]=='v'){
ba=strlen(str);
strncpy(aaa,str,ba);
for(j=0,j<=b-a+1;j++){
str[j+a]=aaa[b-j];
}

}








}

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:36:21: error: expected ';' before ')' token
   36 | for(j=0,j<=b-a+1;j++){
      |                     ^
      |                     ;
Language: C

#include <stdio.h>
#include <string.h>

int main()
{
    char str[1001] = {0};
    char cmd[8] = {0};
    int length;
    int q, i, j, a, b;
    
    scanf("%s", str);
    length = strlen(str);
    scanf("%d", &q);
    
    for(i=0; i<q; i++){
        scanf("%s", cmd);
        scanf("%d%d", &a, &b);
        if(strcmp(cmd, "print")){
            for(j=a, j<=b; j++) printf("%c", str[j]);
            printf("\n");
        } else if(strcmp(cmd, "reverse")){
            char tmp[1001] = {0};
            strcpy(tmp, str);
            for(j=a, j<=b; j++) str[j] = tmp[b-j];
        } else if(strcmp(cmd, "replace")){
            char p[b-a+1] = {0};
            scanf("%s", p);
            for(j=a, j<=b; j++) str[j] = p[j-a];
        }
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:19:31: error: expected ';' before ')' token
   19 |             for(j=a, j<=b; j++) printf("%c", str[j]);
      |                               ^
      |                               ;
main.c:24:31: error: expected ';' before ')' token
   24 |             for(j=a, j<=b; j++) str[j] = tmp[b-j];
      |                               ^
      |                               ;
main.c:26:29: error: variable-sized object may not be initialized except with an empty initializer
   26 |             char p[b-a+1] = {0};
      |                             ^
main.c:28:31: error: expected ';' before ')' token
   28 |             for(j=a, j<=b; j++) str[j] = p[j-a];
      |                               ^
      |                               ;