Advertencia: subíndice de matriz tiene tipo char
Cuando estoy ejecutando este programa, recibo una advertencia: "El subíndice de matriz tiene el tipo 'char'". Por favor, ayúdame donde va mal. Estoy usando code:: blocks IDE
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
void NoFive()
{
long long int cal;
char alpha[25];
char given[100] = "the quick brown fox jumped over the cow";
int num[25];
int i, k;
char j;
j = 'a';
k = 26;
cal = 1;
for(i = 0; i <= 25; i++)
{
alpha[i] = j++;
num[i] = k--;
// printf("%c = %d \n", alpha[i], num[i]);
}
for(i = 0; i <= (strlen(given) - 1); i++)
{
for(j = 0; j <= 25; j++)
{
if(given[i] == alpha[j]) ***//Warning array subscript has type char***
{
cal = cal * num [j]; ***//Warning array subscript has type char***
}
else
{
}
}
}
printf(" The value of cal is %I64u ", cal);
}
main()
{
NoFive();
}
31
Author: Rasmi Ranjan Nayak, 2012-04-02
1 answers
Simple, cambiar
char j;
A
unsigned char j;
O solo a un simple (u)int
unsigned int j;
int j;
-Wchar-subíndices Advierten si un subíndice de matriz tiene el tipo char. Esta es una causa común de error, ya que los programadores a menudo olvidan que este tipo es firmado en algunas máquinas. Esta advertencia está activada by-Wall.
El compilador no quiere que usted especifique inadvertidamente un índice de matriz negativo. Y de ahí la advertencia!
56
Author: Pavan Manjunath,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-04-26 18:05:59
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-04-26 18:05:59