1. 解释“invalid types ‘char[int]’ for array subscript”错误的含义 “invalid types ‘char[int]’ for array subscript”这个错误意味着在尝试使用数组下标访问一个数组元素时,下标的类型不正确。在C或C++等编程语言中,数组下标必须是整型(int)类型。如果出现这个错误,通常意味着你使用了非整型的表达式作为数...
Hello, I have this code that gives me the error from the title: This is problem statement: Given a string of "s" consisting of two words separated by space (first
void red(int n,int m,char *a1)char a1 --> char *a1;穿的是地址!void red(int n,int m,char *a1){ char *p;int i;p=&a1[m-1];for( i=0;i<m;i++,p++){printf("%c",*p);} }
手机版 我的知道 [Error] invalid types 'char[int]' for array subscript #include <stdio.h> #include <stdlib.h> int main() { char a[20]; char out[9]; int i,m,n; FILE *fp; printf("请输入20个单词:\n"); gets(a); if((fp=fopen("e:\\1.txt","w"))==NULL) { printf("...
In function 'int main()': Line 52: error: invalid types 'char[int]' for array subscript compilation terminated due to -Wfatal-errors. Any ideas? Jun 5, 2013 at 2:02am vlad from moscow(6539) You defined heshecaps as a single character. So you may not use the subscript operator with...
C++报错之 invalid types’double[10][double] for array subscript,程序员大本营,技术文章内容聚合第一站。
#include <iostream> using namespace std; class Book{ // declaring private class data members private: char book_name[50]; float book_price; int bookid; char author[20]; bool available; int year; public: // declaring constructor Book() { cout<<"Default constructor is called"<<endl; nam...
max函数中array变量是int*类型,它是int数组bai,后面只能一个下标,写了多处array[I][j],当做二维数组来用。max函数最后一个for循环,for循环应该有三部分,它们以分号隔开,这里只有一部分,没有分号隔开。include <iostream> using namespace std;int max(int (*array)[100],int I,int J,int...
C++中的动态数组是以动态内存分配来实现的,即用new和delete动态分配和删除数组空间,所以像int Rev[len];这样的定义是非法的。根据楼主说的main函数中可以编译,那可能是在main函数中,len被赋予了常量,这样C++能够根据语法判断出实际是类似于int Rev[10]这样的定义,所以是可以编译通过的。但是在函数...
main.cpp:34:63: error: invalid types ‘int[int]’forarray subscript result[size]=multiply(num1[size],num2[size]); c++ programme: usingnamespacestd; #include intmain() { intsize,num1,num2; charoperation[size]; intresult[size];