Write an arm subroutine which will extract a substring from

Assignment Help Application Programming
Reference no: EM13370167

Write an ARM subroutine which will extract a substring from a string. You will need to use the library routine malloc to allocate memory for the new string.

The subroutine signature is:

            char * mysubstring( char string[], int start, int end ) ;

 

where char string[] is the string to extract the substring from; it is passed into the ARM routine as a pointer in a1 to the first element of the character (byte) array,

int start is the first character to extract from the string to the substring; it is passed into the ARM routine as a value in a2,

int end is the last character to extract from the string to the substring; it is passed into the ARM routine as a value in a3.

The return is a pointer to the new string.

#include <stdio.h>

#include <stdlib.h>

extern char * mysubstring( char string[], intstart, int end ) ;

int main( intargc, char * argv[] )

{

            chartosub[] = "this is the string to substring" ;

            char * result ; /* pointer to new string */

 

            result = mysubstring( tosub, 12, 17 ) ;

            printf( "String: %s\nSubstring: %s\n", tosub, result ) ;

 

            exit( 0 ) ;

}

To use the library routine malloc you need to calculate the number of bytes of memory you are requesting, put that number in a1 and blmalloc. Upon return from the library routine a1 will have a pointer to the allocated memory.

You may assume that the start and end values are within the string and  malloc returns a proper pointer value.

Reference no: EM13370167

Questions Cloud

The attached article is about a field study in arkansas : the attached article is about a field study in arkansas. discuss the cultural identity and the conditions of the newest
Question 1 the world price for baseballs is 24 per dozen : question 1. the world price for baseballs is 24 per dozen and almost all of them are produced outside the u.s. suppose
The objective is for you to assimilate your knowledge : the objective is for you to assimilate your knowledge gained from readings discussions and work in this course into a
The design of the software1 report of the software design2 : the design of the software1 report of the software design2 implement the software as per the design and demonstrate
Write an arm subroutine which will extract a substring from : write an arm subroutine which will extract a substring from a string. you will need to use the library routine malloc
Analyses and discuss how the overall nature of demand : analyses and discuss how the overall nature of demand affects planning and control. as described demand management as
Us retailer case study and discuss the issueshere is a : us retailer case study and discuss the issueshere is a suggested guideline for this case study and other case
Describe breifly about critical evaluation of adam smiths : describe breifly about critical evaluation of adam smiths theory.outline of its purest form and what is its critism
Traditional herbal medicinal used in the management of : traditional herbal medicinal used in the management of sexual importance in marakwet east.1. the project summarythis

Reviews

Write a Review

Application Programming Questions & Answers

  Electricity modellingit deals with electricity usage data

electricity modellingit deals with electricity usage data for 241 households in new zealand that was collected in

  Project title computer sales and repair store system -

project title computer sales and repair store system - csrssit is required to design a relational database system for a

  Basic requirementsscreen one has three edittext views and

basic requirementsscreen one has three edittext views and one button.the edittext views allow you to enter a students

  Discussion htmlcssjavascript placementnbspplease respond to

discussion htmlcssjavascript placementnbspplease respond to the followingcompare and contrast the process of adding

  Problem descriptionyou are working as an engineer for a

problem descriptionyou are working as an engineer for a materials manufacturing research lab and have been asked to

  Questions on programing problem step 1 we ask you to

questions on programing problem step 1 we ask you to produce a project plan and an interim description of the project

  Memory location 2000h has the word 5000h stored in it what

memory location 2000h has the word 5000h stored in it. what does each location contain after inc byte ptr2000h. also

  Design a program that models the worms behavior in the

design a program that models the worms behavior in the subsequent scenarioa worm is moving toward an apple. each time

  1 here is a short program it prints out the value of a

1. here is a short program. it prints out the value of a variable x. ernie and bert disagree about what will be printed

  Problem statementgiven two integers x and y compute the

problem statementgiven two integers x and y compute the product xy multiplication the quotient xy integer division and

  If the user wants to read the input from a file then the

if the user wants to read the input from a file then the output will also go into a different file. if the user wants

  Part - 1 object-oriented designwrite a program that allows

part - 1 object-oriented designwrite a program that allows an instructor to keep a grade book. each students has scores

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd