Hellow I'm just started whit C.
I'm usig gcc and get this error:
test.c: In function 'main':
test.c:8: warning: passing argument 1 of 'strlen' makes pointer from integer without a cast
.....
This is my code:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]){
int arg = atoi(argv[argc-1]);
int relay;
int i;
for(i = 0; i < strlen(arg); i++)
{
if (strcmp(arg, "1") == 0){
relay = 1;
}else{
if (strcmp(arg, "2") == 0){
relay = relay + 2;
}else{
if (strcmp(arg, "3") == 0){
relay = relay + 4;
}else{
if (strcmp(arg, "4") == 0){
relay = relay + 8;
}else{
if (strcmp(arg, "5") == 0){
relay = relay + 16;
}else{
if (strcmp(arg, "6") == 0){
relay = relay + 32;
}else{
if (strcmp(arg, "7") == 0){
relay = relay + 64;
}else{
if (strcmp(arg, "8") == 0){
relay = relay + 128;
}
printf("relay %d/n", relay);
}}}}}}}
}
}
What is I doing wrong?