Jump to content

Recommended Posts

Posted
   while(aux[0]!='x'){
				 scanf(" %[^\n]", &aux);
				 char aux2[101];
				 v=0;
				 j=0;
				 while(j<strlen(aux)){
									  printf("%d, %s, %d\n", j, aux2,strlen(aux));
									  if(aux[j]=='0'||aux[j]=='1'||aux[j]=='2'||aux[j]=='3'|| aux[j]=='4'||aux[j]=='5'||aux[j]=='6'||aux[j]=='7'||aux[j]=='8'||aux[j]=='9'){
																							 aux2[v]=aux[j];
																							 v++;
																							 }
									  j++;
									  }

tentei declarar a string no inicio do loop mas nao resultou...alguem me sabe dizer como consigo apagar todos os elementos da string aux2?

Posted

Ao definires a variavel, inicializa-a a zeros.

char aux2[101] = ""; // tudo a zero (em C nao ha inicializacao parcial)

What have you tried?

Não respondo a dúvidas por PM

A minha bola de cristal está para compor; deve ficar pronta para a semana.

Torna os teus tópicos mais atractivos e legíveis usando a tag CODE para colorir o código!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.