Quote Originally Posted by nynicue View Post
Are you sure & needs to be there?
No, it doesn't. It has been removed.

Quote Originally Posted by msh View Post
The above does not do what you think it does. What type is rank?

Read up on string library.
Compile with -Wall option. This will also make the compiler give you warnings.
rank needs to be a string. Thanks for the link, I'm definitely gonna have to read up on this. I'm floundering on pointers and strings.

Last question, I think:
Is there a function that will trim null characters off an user-entered array (rank), or is it understood it will be there and checked for in comparisons, like if (rank='A')? Also, here is the new code in case it may help any other newcomers to c out:
Code:
#include <stdio.h>
#include <string.h> /* strcpy */

char * act(char rank[3], int roll, char result[7]);

int main (void){
	int roll;
	char rank[3];
	char result[7];
	printf("Enter rank: ");
	scanf("%2s", rank); /* %2s limits the allowed input and prevent buffer overflows */
	printf("Rank: %s...\n", rank);
	roll = roll_hundred(0);
	printf("\tRoll: %d. Result: %s.\n", roll, act(rank,roll,result));
	return 0;
}

int roll_hundred(int mod){
	int roll, stime;
	srand (time(NULL));
	roll = rand() % 100 + 1;
	roll = roll + mod;
	return(roll);
}

char * act(char rank[], int roll, char result[]){
	printf("lol: %s", rank);
if(rank=="A"){
	if(roll>=100){strcpy(result, "Red");}
	else if(roll>=99){strcpy(result, "Green");}
	else if(roll>=74){strcpy(result, "Blue");}
	else if(roll>=18){strcpy(result, "White");}
	else{strcpy(result, "Black");}
	}
else if(rank=="1"){
	if(roll>=100){strcpy(result, "Red");}
	else if(roll>=99){strcpy(result, "Orange");}
	else if(roll>=98){strcpy(result, "Yellow");}
	else if(roll>=96){strcpy(result, "Green");}
	else if(roll>=71){strcpy(result, "Blue");}
	else if(roll>=15){strcpy(result, "White");}
	else{strcpy(result, "Black");}
	}
else if(rank=="11"){
	if(roll>=98){strcpy(result, "Red");}
	else if(roll>=93){strcpy(result, "Orange");}
	else if(roll>=83){strcpy(result, "Yellow");}
	else if(roll>=71){strcpy(result, "Green");}
	else if(roll>=49){strcpy(result, "Blue");}
	else if(roll>=5){strcpy(result, "White");}
	else{strcpy(result, "Black");}
	}
else{
	strcpy(result, "Error");
}
	return(result); 
}
Thanks again to everyone for being so helpful and responding so quickly!