Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!