2
The function switch
and I don’t know what I’m doing wrong marcos
there appear "landmarks and cool" and put murilo
"Nice and cool". I’m doing it like this:
#include <stdio.h>
#include <conio.h>
int main(void)
{
char marcos;
printf("Digite um nome e veja? ");
scanf("%s",&nome);
switch (nome)
{
case 'marcos' :
printf("Marcos e legal");
break;
case 'murilo':
printf("Murilo e bacana");
break;
default:
printf("errado");
getch();
return 0;
}
}
Click [Edit], select the code block and press
control+K
to format, or use the button{ }
format bar. It would be nice to take advantage of the editing and describe better what went wrong with your attempt.– Bacco
@Factorals if the
case
s are numerical cannot be duplicated from this.– Maniero
"switch" is not a function, is a command
– zentrunix
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero