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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:29:28+00:00 2026-06-09T07:29:28+00:00

I am using this part of c code in carbide c/c++ char c1[]={0x01}; char

  • 0

I am using this part of c code in carbide c/c++

   char c1[]={0x01};
   char c2[]={0x02};
   char*  c [] = {c1,c2};

when i check values of c[0],c[1].. i am seeing two values like this in debug mode

c[0] = \x01\x01 & (x) = *[0] = \x01  
c[1] = \x02\x01\x01 & (x) = *[1] = \x02

and if i calculate length like this

int cclen2 = strlen(c[0]); 

getting cclen2 = 2; but i should get values as 1.

  • 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-09T07:29:34+00:00Added an answer on June 9, 2026 at 7:29 am

    c1 and c2 do not have null terminators, and strlen() requires a null terminator (along with many other C string handling functions, like printf("%s", c1) for example). A null terminator is only implicitly added when a string literal is used to initialise the char[].

    Change to either:

    char c1[] = { 0x01, 0x00 };
    char c2[] = { 0x02, 0x00 };
    

    or:

    char c1[] = "\x01";
    char c2[] = "\x02";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to rewrite this part of code using generator : basic = []
The code we're using is straightforward in this part of the search query: myCriteria.Add(
This is a two-part question. I'm using jQuery for a project and wanting to
I have this part of code that was compiling using ARMASM : /* Software
im getting a weird error using this code (part of a class): from sys
I'm using this part of code in my system. double countA = 0.00; double
At some part of my code I am using this line [[self navigationController] pushViewController:myController
I'm using this part of code in my app : SimpleDateFormat sdf = new
I am using this particular part of code which i found on the net,
I am using this code to send mail with php http://www.siteduzero.com/tutoriel-3-35146-e-mail-envoyer-un-e-mail-en-php.html#ss_part_4 . This code

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.