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

  • Home
  • SEARCH
  • 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 899389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:12:34+00:00 2026-05-15T15:12:34+00:00

This is a homework question. Frankly, I’m not sure how a C program delivers

  • 0

This is a homework question. Frankly, I’m not sure how a C program delivers a string parameter to the assembly level.

I have the function

StringSearchInString( text, searchString);

and the parameters

text = "Hallo Alles klar"

searchString = "ll"

I know ARM delivers the parameters into register R0, R1 respectively for text, searchString, but I’m not sure how this works with charactesr. If each character is 8 bits in length, then the register is mercilessly slaughtered by the incoming string.

I have since read that the ARM APCS converts the arguments as words, of which the first 4 bytes are stored in the register and the rest are loaded in reverse order on the stack.

Sooo… what? I’m not understanding this. The string text would be stored in R0, the first four bytes, “Hall” are stored in R0, and the rest in reverse order on the stack? Am I understanding that right? How do I call them?

TL;DR: How do I pass a string argument from a C-Program into assembly and how do I work/load/do stuff with it?

ANSWER:

In the remote case that anybody is looking for a solution to this as well, here it is:

As Greg Hewgill has said, strings are passed as a pointer to the string. Therefore, the value in R0 is an address to the string. You therefore use indirect addressing to access the value like so:

StringSearchInString( text, searchString ); // calls the ARM function...

//Going into the ARM function...

LDRB R4, [R0], #1 // Load the first value of R0 into R4 and skip 
                  // ahead one character(8 bits)
                  // Note the "B" in LDR. It indicates that you load ONLY 1 byte!
MOV R0, R4        // Move the value of R4 into R0. This destroys the pointer
                  // Stored in R0! Careful!

And success! If your string is “hallo Alles klar” like mine, you will have 0x68 loaded into register R0. This is the ASCII value of “h”. From this you should be able to start working with strings.

  • 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-15T15:12:35+00:00Added an answer on May 15, 2026 at 3:12 pm

    The short answer is that in C, strings are passed as a pointer to the character data somewhere else. For example, R0 might contain the value 0x01000078, which would be interpreted as a pointer to the "Hallo Alles klar" data in memory, followed by a null character (00 byte).. This is not unique to ARM.

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

Sidebar

Ask A Question

Stats

  • Questions 495k
  • Answers 495k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I think what you're looking for is the polymorphic_path helper.… May 16, 2026 at 11:25 am
  • Editorial Team
    Editorial Team added an answer The debug DLLs are provided in the vc\Debug_NonRedist subdirectory. Properly… May 16, 2026 at 11:25 am
  • Editorial Team
    Editorial Team added an answer JSON.stringify takes more optional arguments. Try: JSON.stringify({a:1,b:2,c:{d:1,e:[1,2]}}, null, 4); //… May 16, 2026 at 11:25 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

This is a homework question,I'm trying to do a Depth-first search function in Scheme,Here's
Okay this is a homework question, and I just don't have a clue how
First off, this is a homework question so vector libraries and string libraries are
This is a homework question I am sorry but I am lost. What happens
This is a homework question from compiler design course. I just need an explanation
This is a homework question: Explain the transformations the type of a routine undergoes
this is a homework question. I am doing diffs on our domain model and
First of all: this is not a homework assignment, it's for a hobby project
I have this piece of code in C: int q = 10; int s
This is a sort of trivial question but something I've been wondering about. In

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.