Jump to content
guilhoto

como apagar uma string?

Recommended Posts

guilhoto

   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?

Share this post


Link to post
Share on other sites
pmg

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!

Share this post


Link to post
Share on other sites
guilhoto

invalid initializer

empy caracter constant

dao-me esses dois erros caso faça isso...

esquece enganei-me xD, usei pliclas em vez de aspas...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.