Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
Standard Input C: Incorrect string if $ is present

I am trying to take input from the STDIN. If the input string starts with character '$' then the input is not converted to string as it is.

int main(int argc, char*argv[]){
     printf("%s\n",argv[1]);
}

Can someone please let me know to why C compiler replaces the characters with '0' if it encounters the '$' symbol ?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It's not your program. It's your shell interpreting it as a variable, then passing its value to your program.

To work around this, escape the $ when you invoke the program from your shell.

./yourprogram '$arg'
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda