Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 730735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:56:45+00:00 2026-05-14T06:56:45+00:00

I am writing a C program. It takes its arguments from commandLine. I want

  • 0

I am writing a C program. It takes its arguments from commandLine. I want to change the commandLine arguments in the code. As they are defined as “const char *”, I can not change them using “strcpy”, “memcpy”, … Also, you know, I can not just change their type from “const char *” to “char *”.
Is there any way to change them?

Thank you so much in advance.

Best regards,
Shadi.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:56:45+00:00Added an answer on May 14, 2026 at 6:56 am

    According to C99 §5.1.2.2.1/1, the signature for main is

    int main(int argc, char *argv[]) { /* ... */ }
    

    So you are allowed to remove the const. Just don’t cause a buffer overrun by strcpying in longer strings than the original arguments, or attempting to install more arguments than originally passed.

    Everyone else is basically right that you should create a copy instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a program in C++ and it takes some command line arguments. The
I'm writing a program, which takes two words as command line arguments, does something
I'm writing a piece of client-side javascript code that takes a function and finds
I am writing a C# program that takes in a bunch of parameters and
Please help me in writing a Program that takes a single digit or value
I am making a program that takes input from files that I have called
My Perl program takes some text from a disk file as input, wraps it
I'm writing a program for Linux that stores its data and settings in the
I was writing a little program that takes a list and generates a menu
I want to perform disk I/O operations for a program that takes too much

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.