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 8157087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:09:33+00:00 2026-06-06T17:09:33+00:00

This isn’t working in visual studio 2010 , it gives me the following error

  • 0

This isn’t working in visual studio 2010 , it gives me the following error

void main (void)
{
     unsigned char* test = "ATGST"; 

}

Edit 1: My question is why this works on Embedded systems, but doesn’t work on PC?

enter image description here

But when I change it to :

 char* test = "ATGST";  

it works.

The main thing that I write code for embedded systems using C, and I use visual studio to test some functions so I don’t have to test it in real time on a Micro-controller.

I need an explanation, because Micro-controllers accepts the first code.

  • 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-06-06T17:09:36+00:00Added an answer on June 6, 2026 at 5:09 pm

    Edited to conform to the removal of the C++ tag and to appease the embedded tag.

    First, the problem at hand, you are trying to pass a char[] literal into an unsigned char*. You can’t really equate char with either unsigned or signed, it is a bit special in that regard. Also, a string literal is given unique storage and should never be modified. If you’re dealing with characters, you need to use a standard char* in which char[] can decay into. You could forcefully cast it, but I don’t like to recommend such things. It is safe to do, as one of the comments pointed out. Actually, it is actually one of the rare things that are really a safety no-brainer.

    But there is far too little space for a tight answer to provide enough qualification on reinterpret_casting, which is basically saying to the compiler that you know what you’re doing. That is potentially very dangerous and should only be done when you’re quite sure about the problem at hand. The char is usually just generic, not even signed or unsigned. Since an unsigned char has a bigger range than a char and usually char uses the positive subset of the signed char to describe characters (or any other kind of data that can fit), if your data is not in the extended positive range, you’re good to go. But, do conform to the environment and code safely.

    On the entry point function – conforming edit

    Since it has been established that you work on an embedded system, this implies that your program is very likely not required to return anything, so it can remain void main() (it could also be the case that it requires very different returns specified by the given embedded system, the OP knows the most about the requirements his system imposes). In a lot of cases, the reason you can remain with void is because there is no environment/OS to appease, nobody to communicate with. But embedded systems can also be quite specialized and it is best to approach by studying the given platform in detail in order to satisfy the requirements imposed (if any).

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

Sidebar

Related Questions

This isn't working. I'm trying to replicate the animate to red and then remove
This isn't working in IE (although it does work in FFX). Why? Using HTML
This isn't working the way I expect it to. Sample input will include an
This isn't a question on proper coding practice, I'm just working through the semantics.
This isn't working: $.ajax({url: PStoreZoomArea.php, type: get, data: {mapza: mapZoomArea, mapc: mapCenter, mapz: mapZoom}})
This isn't working in SQL Server 2008: ALTER TABLE Employee ALTER COLUMN CityBorn SET
This isn't really related to a specific error; my code is not doing what
This isn't working. Can this be done in find? Or do I need to
This isn't my code, I'm just troubleshooting it. Some code that has been working
This isn't working for me: $('select').each(function() { alert($(this).find('option').attr('selected').length); } actually what I really need

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.