Computers and Technology

// Problem 3: reverseOneString (15 points)
// Reverse the string s by using pointer.
// Use pointer p and 'temp' char to swap 1st char with last, then 2nd char with (last-1) and so on..
// Finally return pointer p which points to start of the reversed string.
// You may declare and use more pointers if needed.
// Hint: You might want to check if your logic works with even as well as odd length string.
// You can write test code to print out the reversed string to check if your function works. (Don't include it in final submission)
char* reverseOneString(char s[STRING_LENGTH])
{
char temp; // not necessary to use this variable
char *p = &s[0]; // pointer to start of string
// enter code here

return p;
}

// Problem 4: reverseStrings (5 points)
// Reverse all the strings in 'strings[][]'
// For each string in 'strings', use the reverseOneString() to reverse it.
// You may declare and use more pointers if needed.
void reverseStrings(char strings[NUM_STRINGS][STRING_LENGTH] )
{
char *ptr = &strings[0][0];
// enter code here

}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 16:10, katherineweightman
When copying and pasting text, the first step is move your cursor type the text select the copy command select the paste command
Answers: 2
image
Computers and Technology, 22.06.2019 22:40, ihatemylife0
Least square fit to polynomial write a function leastsquarefit3pol that solves a linear system of equations to find a least squares fit of a third order polynomial to an experimental data set given as two row arrays. the function leastsquarefit3pol must explicitly solve a set of linear equations and cannot use polyfit. there should be no restriction on the size of the problem that can be solved.
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, vivian2020
Read this excerpt from helen keller’s autobiography, the story of my life. have you ever been at sea in a dense fog, when it seemed as if a tangible white darkness shut you in, and the great ship, tense and anxious, groped her way toward the shore with plummet and sounding-line, and you waited with beating heart for something to happen? i was like that ship before my education began, only i was without compass or sounding-line, and had no way of knowing how near the harbour was. "light! give me light! " was the wordless cry of my soul, and the light of love shone on me in that very hour. . the morning after my teacher came she led me into her room and gave me a doll. the little blind children at the perkins institution had sent it and laura bridgman had dressed it; but i did not know this until afterward. when i had played with it a little while, miss sullivan slowly spelled into my hand the word "d-o-l-l." i was at once interested in this finger play and tried to imitate it. when i finally succeeded in making the letters correctly i was flushed with childish pleasure and pride. running downstairs to my mother i held up my hand and made the letters for doll. i did not know that i was spelling a word or even that words existed; i was simply making my fingers go in monkey-like imitation. in the days that followed i learned to spell in this uncomprehending way a great many words, among them pin, hat, cup and a few verbs like sit, stand and walk. based on this excerpt, which words best describe helen keller?
Answers: 2
image
Computers and Technology, 23.06.2019 16:10, alexis9658
What is the ooh? a. omaha occupation handbook b. online occupational c. occupations online d. occupational outlook handbook select the best answer from the choices provided
Answers: 3
Do you know the correct answer?
// Problem 3: reverseOneString (15 points)
// Reverse the string s by using pointer.
/...

Questions in other subjects:

Konu
Mathematics, 22.01.2021 18:50